-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathLayout.tsx
49 lines (46 loc) · 1.04 KB
/
Layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { Outlet } from 'react-router-dom';
import './Layout.css';
import { useAuth, SignInButton, SignOutButton } from '../../api/useAuth.jsx';
/**
* TODO: The links defined in this file don't work!
*
* Instead of anchor element, they should use a component
* from `react-router-dom` to navigate to the routes
* defined in `App.jsx`.
*/
export function Layout() {
const { user } = useAuth();
return (
<>
<div className="Layout">
<header className="Layout-header">
<h1>Smart shopping list</h1>
{user ? (
<div>
<span>Signed in as {user.displayName}</span> (
<SignOutButton />)
</div>
) : (
<SignInButton />
)}
</header>
<main className="Layout-main">
<Outlet />
</main>
<nav className="Nav">
<div className="Nav-container">
<a href="/#" className="Nav-link">
Home
</a>
<a href="/#" className="Nav-link">
List
</a>
<a href="/#" className="Nav-link">
Manage List
</a>
</div>
</nav>
</div>
</>
);
}