Skip to content

Commit 0ba6199

Browse files
committed
feat: enhance navbar
1 parent 6748323 commit 0ba6199

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

src/lib/components/elements/navbar.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ ListItem.displayName = "ListItem"
4040

4141
export default function Navbar() {
4242
const { theme, setTheme } = useTheme()
43+
const [open, setOpen] = React.useState(false)
4344

4445
return (
4546
<div className="sticky top-0 z-50 w-full p-2 py-3 border-b bg-background/60 backdrop-blur-sm">
@@ -95,15 +96,15 @@ export default function Navbar() {
9596
</svg>
9697
</button>
9798

98-
<DropdownMenu>
99-
<DropdownMenuTrigger asChild>
99+
<DropdownMenu open={open} onOpenChange={setOpen}>
100+
<DropdownMenuTrigger asChild onClick={() => setOpen(!open)}>
100101
<Button variant="ghost" size="icon">
101102
{theme === 'light' ? <SunIcon className="h-5 w-5" /> :
102103
theme === 'dark' ? <MoonIcon className="h-5 w-5" /> :
103104
<LaptopIcon className="h-5 w-5" />}
104105
</Button>
105106
</DropdownMenuTrigger>
106-
<DropdownMenuContent align="end">
107+
<DropdownMenuContent align="end" className="w-56">
107108
<DropdownMenuItem onClick={() => setTheme('light')}>
108109
<SunIcon className="mr-2 h-4 w-4" />
109110
Light

src/lib/components/ui/dropdown-menu.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as React from "react"
21
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
32
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
3+
import * as React from "react"
44

55
import { cn } from "@/utils"
66

@@ -237,19 +237,11 @@ function DropdownMenuSubContent({
237237
}
238238

239239
export {
240-
DropdownMenu,
241-
DropdownMenuPortal,
242-
DropdownMenuTrigger,
243-
DropdownMenuContent,
244-
DropdownMenuGroup,
245-
DropdownMenuLabel,
246-
DropdownMenuItem,
247-
DropdownMenuCheckboxItem,
248-
DropdownMenuRadioGroup,
240+
DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent,
241+
DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup,
249242
DropdownMenuRadioItem,
250243
DropdownMenuSeparator,
251244
DropdownMenuShortcut,
252-
DropdownMenuSub,
253-
DropdownMenuSubTrigger,
254-
DropdownMenuSubContent,
245+
DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger
255246
}
247+

src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const posts = await getCollection("blog", (post) => {
3838
Elegant documentation tooling for UnJS ecosystem.
3939
</p>
4040

41-
<div class="flex gap-5">
41+
<div class="flex flex-col md:flex-row gap-5 w-full">
4242
<Button>
4343
<RocketIcon className="w-5 h-5" />
4444
Get started</Button

0 commit comments

Comments
 (0)