2021-04-25 15:22:52 +00:00
|
|
|
import React, { Fragment, useContext } from "react"
|
2021-04-21 13:08:54 +00:00
|
|
|
import Style from "./Sidebar.module.css"
|
|
|
|
import classNames from "classnames"
|
2021-04-21 13:37:12 +00:00
|
|
|
import Logo from "./Logo"
|
2021-04-21 13:53:23 +00:00
|
|
|
import ButtonSidebar from "./ButtonSidebar"
|
2021-04-25 15:22:52 +00:00
|
|
|
import { faCog, faExclamationTriangle, faFolder, faHome, faKey, faWrench } from "@fortawesome/free-solid-svg-icons"
|
|
|
|
import ContextLogin from "../contexts/ContextLogin"
|
2021-04-21 13:08:54 +00:00
|
|
|
|
|
|
|
|
2021-04-23 00:18:06 +00:00
|
|
|
/**
|
|
|
|
* The sidebar of the website, with the logo, buttons to switch between the various pages and a notification counter.
|
|
|
|
*
|
|
|
|
* @todo The notification counter is still missing.
|
|
|
|
* @param className - Additional class(es) to be added to the outer container.
|
|
|
|
* @param props - Additional props to be passed to the outer container.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
export default function Sidebar({ className, ...props }) {
|
2021-04-25 15:22:52 +00:00
|
|
|
const {state} = useContext(ContextLogin)
|
|
|
|
|
2021-04-21 13:08:54 +00:00
|
|
|
return (
|
|
|
|
<div className={classNames(Style.Sidebar, className)} {...props}>
|
2021-04-21 13:37:12 +00:00
|
|
|
<Logo/>
|
2021-04-25 15:22:52 +00:00
|
|
|
{
|
|
|
|
state ?
|
|
|
|
<Fragment>
|
|
|
|
<ButtonSidebar to={"/dashboard"} icon={faHome}>Dashboard</ButtonSidebar>
|
|
|
|
<ButtonSidebar to={"/repositories"} icon={faFolder}>Repositories</ButtonSidebar>
|
|
|
|
<ButtonSidebar to={"/alerts"} icon={faExclamationTriangle}>Alerts</ButtonSidebar>
|
|
|
|
<ButtonSidebar to={"/settings"} icon={faCog}>Settings</ButtonSidebar>
|
|
|
|
</Fragment>
|
|
|
|
:
|
|
|
|
<Fragment>
|
|
|
|
<ButtonSidebar to={"/login"} icon={faKey}>Login</ButtonSidebar>
|
|
|
|
</Fragment>
|
|
|
|
}
|
2021-04-22 16:06:50 +00:00
|
|
|
{
|
|
|
|
process.env.NODE_ENV === "development" ?
|
|
|
|
<ButtonSidebar to={"/sandbox"} icon={faWrench}>Sandbox</ButtonSidebar>
|
|
|
|
: null
|
|
|
|
}
|
2021-04-21 13:08:54 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|