-
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
7 changed files
with
213 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import Box from "@mui/material/Box"; | ||
import { Link } from "react-router-dom"; | ||
import { Button, IconButton } from "@mui/material"; | ||
import { Menu, MenuItem, Sidebar, useProSidebar } from "react-pro-sidebar"; | ||
import LogoutIcon from "@mui/icons-material/Logout"; | ||
import AttractionsIcon from "@mui/icons-material/Attractions"; | ||
import HomeOutlinedIcon from "@mui/icons-material/HomeOutlined"; | ||
import ContactsOutlinedIcon from "@mui/icons-material/ContactsOutlined"; | ||
import { ProjectConsts } from "../../../utils/consts/ProjectConsts"; | ||
import { NavigationConsts } from "../../../utils/consts/NavigationConsts"; | ||
import { styles } from "./SideBarStyle"; | ||
|
||
export default function SideBar(props:any) { | ||
|
||
const menuItems = { home: "Home", contact: "Contacts" }; | ||
|
||
const { collapseSidebar, toggleSidebar, collapsed, toggled } = | ||
useProSidebar(); | ||
|
||
const toggle = () => { | ||
toggleSidebar(); | ||
collapseSidebar(); | ||
}; | ||
|
||
return ( | ||
<Box sx={styles.container}> | ||
<Sidebar style={styles.sideBar}> | ||
<Box sx={styles.sideBarContainer}> | ||
<SideBarHeader /> | ||
<hr style={styles.sideBarHR} /> | ||
<SideBarMenu /> | ||
<SideBarFooter /> | ||
</Box> | ||
</Sidebar> | ||
<main style={styles.main}> | ||
{props.children} | ||
</main> | ||
</Box> | ||
); | ||
|
||
function SideBarHeader() { | ||
return ( | ||
<Box sx={styles.sideBarHeader}> | ||
<IconButton onClick={toggle}> | ||
<AttractionsIcon style={styles.sideBarHeaderIcon} fontSize="large" /> | ||
</IconButton> | ||
{!toggled && ( | ||
<h1 style={styles.sideBarHeaderTitle}>{ProjectConsts.Name}</h1> | ||
)} | ||
</Box> | ||
); | ||
} | ||
|
||
function SideBarMenu() { | ||
return ( | ||
<Menu> | ||
<MenuItem | ||
component={<Link to={NavigationConsts.HomePage} />} | ||
icon={<HomeOutlinedIcon />} | ||
> | ||
{menuItems.home} | ||
</MenuItem> | ||
<MenuItem icon={<ContactsOutlinedIcon fontSize="small" />}> | ||
{menuItems.contact} | ||
</MenuItem> | ||
</Menu> | ||
); | ||
} | ||
|
||
function SideBarFooter() { | ||
return ( | ||
<Button | ||
style={styles.signOutButton} | ||
variant="contained" | ||
startIcon={!toggled && <LogoutIcon style={styles.signOutButtonIcon} />} | ||
> | ||
Sign Out | ||
</Button> | ||
); | ||
} | ||
} |
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,44 @@ | ||
import { ColorConsts } from "../../../utils/consts/ProjectConsts"; | ||
|
||
export const styles = { | ||
container: { | ||
display: "flex", | ||
flexDirection: "row", | ||
}, | ||
sideBarContainer: { | ||
backgroundColor: ColorConsts.LightBeige, | ||
height: "100vh", | ||
display: "flex", | ||
flexDirection: "column", | ||
}, | ||
sideBar: {}, | ||
sideBarHeader: { | ||
display: "flex", | ||
alignItems: "center", | ||
flexDirection: "column", | ||
margin: "0.5em 0", | ||
}, | ||
sideBarHeaderTitle: { | ||
color: ColorConsts.DarkBlue, | ||
}, | ||
sideBarHeaderIcon: { | ||
color: ColorConsts.DarkBlue, | ||
}, | ||
sideBarHR: { | ||
backgroundColor: ColorConsts.DarkBlue, | ||
height: "2px", | ||
margin: "0", | ||
border: "0", | ||
}, | ||
main: { | ||
margin: "0 0.5em", | ||
}, | ||
signOutButton: { | ||
marginTop: "auto", | ||
backgroundColor: ColorConsts.DarkBlue, | ||
borderRadius: "0", | ||
}, | ||
signOutButtonIcon: { | ||
transform: "rotate(180deg)", | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import './index.css'; | ||
import App from './App'; | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import "./index.css"; | ||
import App from "./App"; | ||
import { ProSidebarProvider } from "react-pro-sidebar"; | ||
|
||
const root = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
document.getElementById("root") as HTMLElement | ||
); | ||
|
||
|
||
root.render( | ||
<React.StrictMode> | ||
<App /> | ||
<ProSidebarProvider> | ||
<App /> | ||
</ProSidebarProvider> | ||
</React.StrictMode> | ||
); |
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import SideBar from "../../components/ui/side-bar/SideBar"; | ||
|
||
export default function HomePage(){ | ||
return ( | ||
<h1>Home Page</h1> | ||
<SideBar> | ||
<h1>Hello</h1> | ||
</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