Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/HamburgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function HamburgerMenu() {

{isOpen && (
<div className="absolute top-0 bottom-0 h-screen left-0 z-10">
<SideNav />
<SideNav setIsOpen={setIsOpen} />
</div>
)}
</div>
Expand Down
26 changes: 18 additions & 8 deletions components/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import { Badge, Text } from "@/components/retroui";
import Link from "next/link";
import { usePathname } from "next/navigation";

export default function SideNav() {
interface SideNavProps {
setIsOpen?: (isOpen: boolean) => void;
}

export default function SideNav({ setIsOpen }: SideNavProps) {
const pathname = usePathname();

return (
<div
className="sidebar-scroll border-r-2 max-h-screen overflow-y-auto transition-transform transform md:translate-x-0 w-full bg-background flex flex-col justify-start md:justify-start py-8"
>
<nav className="flex flex-col items-start max-lg:px-6 space-y-4" aria-label="Main navigation">
<div className="sidebar-scroll border-r-2 max-h-screen overflow-y-auto transition-transform transform md:translate-x-0 w-full bg-background flex flex-col justify-start md:justify-start py-8">
<nav
className="flex flex-col items-start max-lg:px-6 space-y-4"
aria-label="Main navigation"
>
{navConfig.sideNavItems.map((item) => (
<div key={item.title} className="w-full">
<Text as="h5">{item.title}</Text>
Expand All @@ -21,14 +26,19 @@ export default function SideNav() {
<Link
key={child.title}
href={child.href}
onClick={() => setIsOpen && setIsOpen(false)}
target={child.href.startsWith("http") ? "_blank" : "_self"}
className={`px-2 py-1 w-full border border-transparent text-muted-foreground flex items-center justify-between hover:text-foreground hover:bg-muted/50 transition-colors ${
pathname === child.href && "bg-primary text-primary-foreground"
pathname === child.href &&
"bg-primary text-primary-foreground"
}`}
>
{child.title}
{child.tag && (
<Badge size="sm" className="py-0.5 px-1.5 border text-xs border-secondary text-muted-foreground bg-secondary/10">
<Badge
size="sm"
className="py-0.5 px-1.5 border text-xs border-secondary text-muted-foreground bg-secondary/10"
>
{child.tag}
</Badge>
)}
Expand All @@ -40,4 +50,4 @@ export default function SideNav() {
</nav>
</div>
);
}
}