generated from hack4impact-calpoly/nextjs-app-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from hack4impact-calpoly/3-volunteer-guest-das…
…hboard-frontend feat: guest sidebar
- Loading branch information
Showing
10 changed files
with
194 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ const dashboard = () => { | |
}; | ||
|
||
export default dashboard; | ||
|
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,87 @@ | ||
"use client"; | ||
import { useSelectedLayoutSegment } from "next/navigation"; | ||
import { useState } from "react"; | ||
import Link from "next/link"; | ||
import style from "@styles/admin/sidebar.module.css"; | ||
import { | ||
Bars3Icon, | ||
XMarkIcon, | ||
HomeIcon, | ||
CalendarDaysIcon, | ||
UserIcon, | ||
HandRaisedIcon | ||
} from "@heroicons/react/16/solid"; | ||
|
||
const Sidebar = () => { | ||
// returns the current route that user is on, null if user is on the root (admin page.tsx) | ||
const segement = useSelectedLayoutSegment(); | ||
|
||
// useState 1ining if slider is collapased | ||
const [isCollapsed, setCollapsed] = useState(false); | ||
|
||
const toggleSlider = () => { | ||
setCollapsed(!isCollapsed); | ||
}; | ||
|
||
// can add more options here for admin | ||
const sideBarOptions = [ | ||
{ | ||
name: "Home", | ||
href: "/dashboard", | ||
icon: <HomeIcon style={{ width: "35px", height: "35px" }} />, | ||
current: !segement ? true : false, | ||
}, | ||
{ | ||
name: "Events", | ||
href: "/dashboard/events", | ||
icon: <CalendarDaysIcon style={{ width: "35px", height: "35px" }} />, | ||
current: `/${segement}` === "/events" ? true : false, | ||
}, | ||
{ | ||
name: "Volunteer", | ||
href: "/dashboard/volunteer", | ||
icon: <HandRaisedIcon style={{ width: "35px", height: "35px" }} />, | ||
current: `/${segement}` === "/volunteer" ? true : false, | ||
}, | ||
{ | ||
name: "Profile", | ||
href: "/dashboard/profile", | ||
icon: <UserIcon style={{ width: "35px", height: "35px" }} />, | ||
current: `/${segement}` === "/profile" ? true : false, | ||
}, | ||
]; | ||
|
||
return ( | ||
<div | ||
className={`${style.sidebar} ${isCollapsed ? style.collapsedSidebar : ""}`} | ||
style={{ backgroundColor: "#5DADE2"}} | ||
> | ||
<div className={style.toggleButton} onClick={toggleSlider}> | ||
{isCollapsed ? ( | ||
<Bars3Icon style={{ width: "35px", height: "35px" }} /> | ||
) : ( | ||
<XMarkIcon style={{ width: "35px", height: "35px" }} /> | ||
)} | ||
</div> | ||
<div className={style.adminOptions}> | ||
<ul> | ||
{sideBarOptions.map((option) => ( | ||
<li | ||
key={option.name} | ||
className={`${option.current ? style.currentOption : ""}`} | ||
> | ||
<Link href={option.href}> | ||
<div className={style.option} > | ||
{option.icon} | ||
<p>{isCollapsed ? "" : option.name}</p> | ||
</div> | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const dashboard = () => { | ||
return ( | ||
<div> | ||
<h2>Event Guest Page</h2> | ||
</div> | ||
); | ||
}; | ||
|
||
export default dashboard; |
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,25 @@ | ||
import { ReactNode } from "react"; | ||
import { Montserrat } from "next/font/google"; | ||
import Sidebar from "@components/Sidebar_Guest"; | ||
import style from "@styles/admin/layout.module.css"; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
const montserrat = Montserrat({ subsets: ["latin"], weight: ["300"] }); | ||
|
||
const Layout = (props: Props) => { | ||
return ( | ||
<div className={montserrat.className}> | ||
<div className={style.adminDash}> | ||
<div> | ||
<Sidebar /> | ||
</div> | ||
<main className={style.mainContainer}>{props.children}</main> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Layout; |
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,10 @@ | ||
const dashboard = () => { | ||
return ( | ||
<div> | ||
<h2>Main Guest Dashboard</h2> | ||
</div> | ||
); | ||
}; | ||
|
||
export default dashboard; | ||
|
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,10 @@ | ||
const dashboard = () => { | ||
return ( | ||
<div> | ||
<h2>Profile Guest Page</h2> | ||
</div> | ||
); | ||
}; | ||
|
||
export default dashboard; | ||
|
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,10 @@ | ||
const dashboard = () => { | ||
return ( | ||
<div> | ||
<h2>Volunteer Guest Page</h2> | ||
</div> | ||
); | ||
}; | ||
|
||
export default dashboard; | ||
|
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,9 +1,10 @@ | ||
.adminDash { | ||
display: flex; | ||
display: flex; | ||
} | ||
|
||
.mainContainer { | ||
width: 100%; | ||
text-align: center; | ||
height: 100vh; | ||
padding-top: 50px; | ||
width: 100%; | ||
text-align: center; | ||
height: 100vh; | ||
} |
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