-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
3 changed files
with
97 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use client'; | ||
|
||
import { cn } from '@/lib/utils'; | ||
import { Button } from '@/primitives/button'; | ||
import Link from 'next/link'; | ||
import { usePathname } from 'next/navigation'; | ||
import type { ReactNode } from 'react'; | ||
|
||
interface Props { | ||
href: string; | ||
label: string; | ||
icon: ReactNode; | ||
} | ||
|
||
export function ActiveButton({ href, label, icon }: Props) { | ||
const pathname = usePathname(); | ||
|
||
return ( | ||
<Button | ||
variant="ghost" | ||
className={cn( | ||
'w-full justify-start gap-3 font-normal text-foreground-muted hover:text-foreground', | ||
pathname === href && 'text-foreground', | ||
)} | ||
asChild | ||
> | ||
<Link href={href}> | ||
{icon} | ||
{label} | ||
</Link> | ||
</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,62 @@ | ||
import { | ||
DiamondIcon, | ||
HomeIcon, | ||
ListChecksIcon, | ||
PenLineIcon, | ||
PuzzleIcon, | ||
} from 'lucide-react'; | ||
import Image from 'next/image'; | ||
import type { PropsWithChildren } from 'react'; | ||
import { ActiveButton } from './_components/active-button'; | ||
|
||
const iconSize = 15; | ||
|
||
const sideMenuStaticLinks = [ | ||
{ | ||
icon: <HomeIcon size={iconSize} />, | ||
label: 'Home', | ||
href: '/app', | ||
}, | ||
{ | ||
icon: <PuzzleIcon size={iconSize} />, | ||
label: 'Modules', | ||
href: '/modules', | ||
}, | ||
{ | ||
icon: <ListChecksIcon size={iconSize} />, | ||
label: 'Tasks', | ||
href: '/tasks', | ||
}, | ||
{ | ||
icon: <PenLineIcon size={iconSize} />, | ||
label: 'Notebooks', | ||
href: '/notes', | ||
}, | ||
{ | ||
icon: <DiamondIcon size={iconSize} />, | ||
label: 'Flashcards', | ||
href: '/flashcards', | ||
}, | ||
]; | ||
|
||
export default function AppLayout({ children }: PropsWithChildren) { | ||
return ( | ||
<main className="flex min-h-dvh gap-8 p-4"> | ||
<aside className="w-[220px]"> | ||
<div className="flex items-center gap-3 pl-3 pt-4"> | ||
<Image src="/logo.svg" width={35} height={35} alt="Noodle Logo" /> | ||
<span>Noodle</span> | ||
</div> | ||
|
||
<ul className="mt-8"> | ||
{sideMenuStaticLinks.map(({ icon, label, href }) => ( | ||
<li key={label}> | ||
<ActiveButton icon={icon} label={label} href={href} /> | ||
</li> | ||
))} | ||
</ul> | ||
</aside> | ||
<div className="flex-1 rounded-lg border p-6">{children}</div> | ||
</main> | ||
); | ||
} |
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