added navbar to layout

This commit is contained in:
Ruidy Nemausat 2020-03-05 16:12:46 +01:00
parent 1804f22098
commit 552fe62330
4 changed files with 48 additions and 3 deletions

2
.gitignore vendored
View file

@ -35,3 +35,5 @@ client/.env.production.local
client/npm-debug.log*
client/yarn-debug.log*
client/yarn-error.log*
client/src/authentication/config.json

View file

@ -1,8 +1,19 @@
import React, { FC } from "react";
import Layout from "./pages/Layout";
import { useAuth0 } from "./authentication/auth0";
const App: FC = () => {
return <Layout />;
const { loading } = useAuth0();
if (loading) {
return <div>Loading...</div>;
}
return (
<div className="App">
<Layout />
</div>
);
};
export default App;

29
client/src/index.jsx Normal file
View file

@ -0,0 +1,29 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import { Auth0Provider } from "./authentication/auth0";
import config from "./authentication/config.json";
import history from "./utils/history";
const onRedirectCallback = appState => {
history.push(
appState && appState.targetUrl
? appState.targetUrl
: window.location.pathname
);
};
ReactDOM.render(
<Auth0Provider
domain={config.domain}
client_id={config.clientId}
redirect_uri={window.location.origin}
onRedirectCallback={onRedirectCallback}
>
<App />
</Auth0Provider>,
document.getElementById("root")
);
serviceWorker.unregister();

View file

@ -1,11 +1,14 @@
import React, { FC } from "react";
import { AppRouter } from "../utils/router";
import { NavBar } from "../components/Navbar";
const Layout: FC = () => {
return (
<>
{/* <NavBar />
<BreadCrumb /> */}
<header>
<NavBar />
</header>
{/* <BreadCrumb /> */}
<AppRouter />
{/* <Footer /> */}
</>