-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAuthenticatedLayout.tsx
46 lines (39 loc) · 1.25 KB
/
AuthenticatedLayout.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
import Button from 'react-bootstrap/Button'
import { useAuth } from 'web/src/auth'
import { Link, routes } from '@redwoodjs/router'
import Navigation from 'src/components/Navigation/Navigation'
type AuthenticatedLayoutProps = {
children?: React.ReactNode
}
const AuthenticatedLayout = ({ children }: AuthenticatedLayoutProps) => {
const { currentUser, isAuthenticated, logOut } = useAuth()
return (
<div className="container-fluid" style={{ width: '90%' }}>
<nav className="row navbar navbar-light bg-light d-flex justify-content-between">
<div className="col">
<Link to={routes.uploads()} className="navbar-brand">
CPF Reporter: USDR
</Link>
</div>
<div className="col d-flex justify-content-end">
{isAuthenticated && (
<>
<div className="navbar-text">{currentUser?.email as string}</div>
<Button
size="sm"
variant="link"
className="nav-link navbar-text mx-2"
onClick={logOut}
>
Logout
</Button>
</>
)}
</div>
</nav>
<Navigation />
{children}
</div>
)
}
export default AuthenticatedLayout