-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Sidebar component and update dependencies (#1398)
- Loading branch information
1 parent
6d795a8
commit 95a3820
Showing
8 changed files
with
7,034 additions
and
3,269 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,65 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Typography from '@mui/material/Typography'; | ||
import Divider from '@mui/material/Divider'; | ||
import List from '@mui/material/List'; | ||
import ListItemIcon from '@mui/material/ListItemIcon'; | ||
import ListItemText from '@mui/material/ListItemText'; | ||
import MenuIcon from '@mui/icons-material/Menu'; | ||
import { LoginButton } from './LoginButton'; | ||
import { ListItemButton } from '@mui/material'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
export type LinkType = { title: string; url: string }; | ||
|
||
type Props = { links: LinkType[] }; | ||
interface ListItemsProps { | ||
links: LinkType[]; | ||
} | ||
|
||
function ListItems(props: ListItemsProps) { | ||
const { links } = props; | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<> | ||
{links.map(({ title, url }) => ( | ||
<ListItemButton key={url}> | ||
<ListItemIcon> | ||
<MenuIcon /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primary={title} | ||
sx={{ color: '#fff' }} | ||
onClick={() => navigate(url)} | ||
/> | ||
</ListItemButton> | ||
))} | ||
</> | ||
); | ||
} | ||
|
||
function Sidebar(props: Props) { | ||
return ( | ||
<Box sx={{ width: 250, bgcolor: '#272727', height: '100vh' }}> | ||
<Typography | ||
variant="h6" | ||
noWrap | ||
component="div" | ||
align="center" | ||
sx={{ flexGrow: 1, p: 2 }} | ||
> | ||
Laughing-Train | ||
</Typography> | ||
<Divider /> | ||
<List> | ||
<ListItems links={props.links} /> | ||
</List> | ||
<LoginButton | ||
sx={{ mx: 1, my: 1, color: '#fff', borderColor: '#fff', width: '90%' }} | ||
/> | ||
</Box> | ||
); | ||
} | ||
|
||
export default Sidebar; |
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 |
---|---|---|
|
@@ -77,6 +77,7 @@ const themeOptions: ThemeOptions = { | |
}, | ||
}, | ||
spacing: 8, | ||
|
||
components: { | ||
MuiCard: { | ||
styleOverrides: { | ||
|
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