generated from chingu-voyages/voyage-template
-
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.
Merge pull request #79 from chingu-voyages/css/header
Update Base, Header and Footer Layout & CSS
- Loading branch information
Showing
11 changed files
with
302 additions
and
119 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
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,20 +1,44 @@ | ||
"use client"; | ||
import { Roboto } from "next/font/google"; | ||
import { Montserrat, Roboto, Orbitron } from "next/font/google"; | ||
import { createTheme } from "@mui/material/styles"; | ||
|
||
const montserrat = Montserrat({ | ||
weight: ["400", "500", "600"], | ||
subsets: ["latin"], | ||
display: "swap", | ||
}); | ||
|
||
const roboto = Roboto({ | ||
weight: ["300", "400", "500", "700"], | ||
subsets: ["latin"], | ||
display: "swap", | ||
}); | ||
|
||
const orbitron = Orbitron({ | ||
weight: ["400"], | ||
subsets: ["latin"], | ||
display: "swap", | ||
}); | ||
|
||
const theme = createTheme({ | ||
typography: { | ||
fontFamily: roboto.style.fontFamily, | ||
fontFamily: montserrat.style.fontFamily, | ||
display: { | ||
fontFamily: orbitron.style.fontFamily, | ||
}, | ||
}, | ||
palette: { | ||
branding: "#eab308", | ||
}, | ||
breakpoints: { | ||
values: { | ||
xs: 0, | ||
sm: 480, | ||
md: 768, | ||
lg: 1024, | ||
xl: 1280, | ||
}, | ||
}, | ||
}); | ||
|
||
export default theme; |
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,27 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
import { Box, Stack, Typography } from "@mui/material"; | ||
import { getServerSession } from "next-auth"; | ||
import { authOptions } from "@/auth"; | ||
import Logo from "./Logo"; | ||
import FooterNav from "./FooterNav"; | ||
|
||
export default function Footer() { | ||
export default async function Footer() { | ||
const session = await getServerSession(authOptions); | ||
return ( | ||
<Box component="footer" className="h-20 border-t border-gray-200 py-2 px-4"> | ||
<Typography component="p">© 2024, RayVolution</Typography> | ||
<Box component="footer" className="bg-lightAccent text-background"> | ||
<Stack | ||
gap={4} | ||
sx={{ | ||
width: 1, | ||
maxWidth: "xl", | ||
marginX: "auto", | ||
paddingY: 4, | ||
paddingX: { xs: 2, sm: 4, xl: 2 }, | ||
}} | ||
> | ||
<Logo logoSize={{ xs: 20, sm: 24 }} textSize={{ xs: 26, sm: 32 }} /> | ||
{session && <FooterNav session={session} />} | ||
<Typography sx={{ fontSize: 14 }}>© 2024, RayVolution</Typography> | ||
</Stack> | ||
</Box> | ||
); | ||
} |
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,30 @@ | ||
"use client"; | ||
|
||
import { Stack } from "@mui/material"; | ||
import NavLink from "./NavLink"; | ||
import { navLinks } from "./Nav"; | ||
|
||
export default function FooterNav({ session }) { | ||
const protectedRoutes = navLinks.filter((link) => | ||
link.role.includes(session.user.role) | ||
); | ||
return ( | ||
<Stack component="ul" sx={{ marginY: 2 }}> | ||
{protectedRoutes.map((link) => { | ||
return ( | ||
<NavLink | ||
key={link.label} | ||
link={link} | ||
noscroll | ||
liStyle={{ paddingX: 0 }} | ||
textStyle={{ | ||
fontSize: { xs: 20, xl: 22 }, | ||
fontWeight: 400, | ||
}} | ||
textColor="text-background" | ||
/> | ||
); | ||
})} | ||
</Stack> | ||
); | ||
} |
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,27 +1,42 @@ | ||
"use client"; | ||
|
||
import { Box, Stack, Typography } from "@mui/material"; | ||
import { getServerSession } from "next-auth"; | ||
import { authOptions } from "@/auth"; | ||
import { Box, Stack } from "@mui/material"; | ||
import Nav from "./Nav"; | ||
import Logo from "./Logo"; | ||
|
||
export default function Header() { | ||
export default async function Header() { | ||
const session = await getServerSession(authOptions); | ||
return ( | ||
<Box | ||
component="header" | ||
className="py-2 lg:py-4 px-4 border-b border-gray-200" | ||
sx={{ | ||
paddingY: { xs: 1, md: 1.5 }, | ||
borderBottom: "1px solid #eee", | ||
}} | ||
> | ||
<Stack direction="row" className="justify-between items-center"> | ||
<Typography variant="h5" component="h1"> | ||
<Typography | ||
variant="h5" | ||
component="span" | ||
sx={{ color: (theme) => theme.palette.branding }} | ||
> | ||
Ray | ||
</Typography> | ||
Volution | ||
</Typography> | ||
<Nav /> | ||
</Stack> | ||
<Box | ||
sx={{ | ||
width: { xs: 1 }, | ||
maxWidth: "xl", | ||
marginX: "auto", | ||
paddingX: { xs: 2, sm: 4, xl: 2 }, | ||
}} | ||
> | ||
<Stack | ||
direction="row" | ||
justifyContent="space-between" | ||
alignItems="center" | ||
> | ||
<Logo | ||
logoSize={{ xs: 20, sm: 24, lg: 32 }} | ||
textSize={{ xs: 26, sm: 32, lg: 48 }} | ||
iconColor="text-brandingDark" | ||
mainColor="branding-gradient" | ||
accent="text-accent" | ||
/> | ||
{session && <Nav session={session} />} | ||
</Stack> | ||
</Box> | ||
</Box> | ||
); | ||
} |
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,29 @@ | ||
import Link from "next/link"; | ||
import { Box, Stack, Typography } from "@mui/material"; | ||
import WbSunnyIcon from "@mui/icons-material/WbSunny"; | ||
|
||
export default function Logo({ | ||
logoSize, | ||
textSize, | ||
iconColor, | ||
mainColor, | ||
accent, | ||
}) { | ||
return ( | ||
<Stack direction="row" alignItems="center"> | ||
<Box> | ||
<WbSunnyIcon className={iconColor} sx={{ fontSize: logoSize }} /> | ||
</Box> | ||
<Link href="/" scroll={false}> | ||
<Typography | ||
variant="display" | ||
sx={{ fontSize: textSize }} | ||
className={accent} | ||
> | ||
<span className={mainColor}>Ray</span> | ||
Volution | ||
</Typography> | ||
</Link> | ||
</Stack> | ||
); | ||
} |
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,14 +1,96 @@ | ||
"use client"; | ||
|
||
import { useMediaQuery } from "@mui/material"; | ||
import { MobileNav, DesktopNav } from "./NavElements"; | ||
import { useState } from "react"; | ||
import { Box, Drawer, IconButton, List, Stack } from "@mui/material"; | ||
import MenuIcon from "@mui/icons-material/Menu"; | ||
import CloseIcon from "@mui/icons-material/Close"; | ||
import NavLink from "./NavLink"; | ||
|
||
export default function Nav() { | ||
const matches = useMediaQuery("(min-width: 768px)"); | ||
export const navLinks = [ | ||
{ | ||
label: "Home", | ||
href: "/", | ||
role: ["user", "admin"], | ||
mobile: true, | ||
}, | ||
{ | ||
label: "Service", | ||
href: "/new-appointment", | ||
role: ["user", "admin"], | ||
}, | ||
{ | ||
label: "Appointments", | ||
href: "/my-appointments", | ||
role: ["user", "admin"], | ||
}, | ||
{ | ||
label: "Admin", | ||
href: "/admin-dashboard", | ||
role: ["admin"], | ||
}, | ||
{ | ||
label: "Sign Out", | ||
href: "/api/auth/signout", | ||
role: ["user", "admin"], | ||
}, | ||
]; | ||
|
||
if (!matches) { | ||
return <MobileNav />; | ||
} | ||
export default function Nav({ session }) { | ||
const [open, setOpen] = useState(false); | ||
|
||
return <DesktopNav />; | ||
const protectedRoutes = navLinks.filter((link) => | ||
link.role.includes(session.user.role) | ||
); | ||
|
||
return ( | ||
<> | ||
{/* MOBILE NAV */} | ||
<Box sx={{ display: { xs: "block", lg: "none" } }}> | ||
<IconButton onClick={() => setOpen(true)}> | ||
<MenuIcon sx={{ fontSize: 30 }} className="text-darkAccent" /> | ||
</IconButton> | ||
<Drawer | ||
open={open} | ||
anchor="left" | ||
onClose={() => setOpen(false)} | ||
sx={{ display: { lg: "none" } }} | ||
> | ||
<Stack direction="row-reverse" className="m-2"> | ||
<IconButton onClick={() => setOpen(false)}> | ||
<CloseIcon sx={{ fontSize: 36 }} className="text-darkAccent" /> | ||
</IconButton> | ||
</Stack> | ||
<Box | ||
sx={{ | ||
width: { xs: 320, sm: 432, md: 690 }, | ||
}} | ||
> | ||
<List> | ||
{protectedRoutes.map((link, idx) => { | ||
return ( | ||
<NavLink | ||
key={link.label} | ||
link={link} | ||
setOpen={setOpen} | ||
idx={idx} | ||
textColor="text-darkAccent" | ||
/> | ||
); | ||
})} | ||
</List> | ||
</Box> | ||
</Drawer> | ||
</Box> | ||
{/* DESKTOP NAV */} | ||
<Box sx={{ display: { xs: "none", lg: "block" } }}> | ||
<Stack component="ul" direction="row" gap={{ lg: 3, xl: 6 }}> | ||
{protectedRoutes | ||
.filter((link) => !link.mobile) | ||
.map((link) => { | ||
return <NavLink key={link.label} link={link} hover />; | ||
})} | ||
</Stack> | ||
</Box> | ||
</> | ||
); | ||
} |
Oops, something went wrong.