-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
271 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
left: 0; | ||
bottom: 0; | ||
max-height: 120px; | ||
margin-top: 2rem; | ||
width: 100%; | ||
} | ||
.footer .row { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
@import '../../variables.scss'; | ||
|
||
nav { | ||
background-color: $blue; | ||
padding: 0 !important; | ||
|
||
li { | ||
align-items: center; | ||
color: $white; | ||
display: flex; | ||
} | ||
|
||
ul { | ||
padding: 0 1rem; | ||
list-style: none; | ||
justify-content: space-between; | ||
width: 100%; | ||
} | ||
|
||
p { | ||
align-items: center; | ||
justify-content: center; | ||
padding: 0; | ||
margin: 0; | ||
list-style: none; | ||
display: flex; | ||
} | ||
|
||
a { | ||
align-items: center; | ||
box-sizing: content-box; | ||
color: inherit; | ||
display: flex; | ||
height: 42px; | ||
justify-content: center; | ||
padding: 0.625rem 1rem; | ||
text-decoration: none; | ||
} | ||
|
||
li:hover:not(.active) { | ||
background-color: $blue-hover; | ||
color: $white; | ||
|
||
a { | ||
color: inherit; | ||
} | ||
} | ||
|
||
span { | ||
padding-left: 0.5rem; | ||
} | ||
} | ||
|
||
.active { | ||
background: $white-smoke; | ||
color: $black; | ||
|
||
:hover { | ||
color: $black; | ||
a { | ||
color: inherit; | ||
} | ||
} | ||
} | ||
|
||
.user { | ||
display: flex; | ||
height: 64px; | ||
white-space: nowrap; | ||
} | ||
|
||
.iconLink { | ||
align-items: center; | ||
display: flex; | ||
} | ||
|
||
.logout { | ||
align-self: center; | ||
height: 42px; | ||
margin: 0rem 1rem; | ||
} | ||
|
||
@media (max-width: 780px) { | ||
nav { | ||
a { | ||
justify-content: left; | ||
padding: 0 1rem; | ||
width: 100%; | ||
} | ||
} | ||
|
||
.user { | ||
height: 42px; | ||
|
||
a { | ||
padding: 0 1rem; | ||
|
||
span { | ||
padding: 0; | ||
} | ||
} | ||
} | ||
|
||
.iconLink { | ||
svg { | ||
display: none; | ||
} | ||
} | ||
|
||
.logout { | ||
margin: 1rem 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { useQueryClient } from '@tanstack/react-query'; | ||
import { useCallback } from 'react'; | ||
import { BsPersonCircle } from 'react-icons/bs'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { TertiaryButton } from '../common/Buttons'; | ||
import { getUserRoles } from '../../lib/utils'; | ||
import styles from './Navbar.module.scss'; | ||
import { Navbar as BootNavbar, Container, Nav } from 'react-bootstrap'; | ||
import { CustomLink } from './CustomLink'; | ||
|
||
export const Navbar: React.FC = () => { | ||
const navigate = useNavigate(); | ||
const queryClient = useQueryClient(); | ||
|
||
const handleLogoutButtonClick = useCallback(() => { | ||
localStorage.removeItem('accessToken'); | ||
localStorage.removeItem('refreshToken'); | ||
|
||
// Invalidate React Query cache | ||
queryClient.clear(); | ||
|
||
navigate('/'); | ||
}, [navigate, queryClient]); | ||
|
||
const { isAdmin, isBlender } = getUserRoles(); | ||
|
||
return ( | ||
<BootNavbar expand="lg"> | ||
<Container> | ||
<span className="navbar-brand d-block d-lg-none d-xl-none text-white"> | ||
Täyttöpaikka | ||
</span> | ||
<BootNavbar.Toggle aria-controls="basic-navbar-nav" /> | ||
<BootNavbar.Collapse id="basic-navbar-nav"> | ||
<div className="d-flex flex-row justify-content-between w-100"> | ||
<Nav> | ||
<CustomLink to="/logbook">Paineilmatäyttö</CustomLink> | ||
|
||
{(isAdmin || isBlender) && ( | ||
<CustomLink to="/blender-logbook">Happihäkki</CustomLink> | ||
)} | ||
|
||
<CustomLink to="/diving-cylinder-set">Omat pullot</CustomLink> | ||
|
||
<CustomLink to="/fill-events">Täyttöhistoria</CustomLink> | ||
</Nav> | ||
<Nav> | ||
<div className={styles.user}> | ||
<CustomLink to="/user"> | ||
<div className={styles.iconLink}> | ||
<BsPersonCircle size={35} /> | ||
<span>Omat tiedot</span> | ||
</div> | ||
</CustomLink> | ||
</div> | ||
<TertiaryButton | ||
className={styles.logout} | ||
onClick={handleLogoutButtonClick} | ||
text="Kirjaudu ulos" | ||
/> | ||
</Nav> | ||
</div> | ||
</BootNavbar.Collapse> | ||
</Container> | ||
</BootNavbar> | ||
); | ||
}; |
Oops, something went wrong.