Skip to content

Commit

Permalink
🐛 Fix dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiorivera committed Dec 26, 2024
1 parent efe9e95 commit 4f2d257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MENU_LINKS, SITE_DESCRIPTION, SITE_TITLE } from "~/consts";
</div>
<div class="flex">
<div class="sm:hidden">
<MobileMenu client:idle />
<MobileMenu client:load />
</div>
<div class="hidden sm:flex">
{MENU_LINKS.map(({ title, url }) => (
Expand Down
11 changes: 9 additions & 2 deletions src/components/mobile-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AlignJustify } from "lucide-react";
import { useState } from "react";
import {
DropdownMenu,
DropdownMenuContent,
Expand All @@ -8,9 +9,15 @@ import {
import { MENU_LINKS } from "~/consts";

export function MobileMenu() {
const [dropdownOpen, setDropdownOpen] = useState(false);

return (
<DropdownMenu>
<DropdownMenuTrigger>
<DropdownMenu open={dropdownOpen} onOpenChange={setDropdownOpen}>
<DropdownMenuTrigger
onClick={() => {
setDropdownOpen((val) => !val);
}}
>
<AlignJustify />
</DropdownMenuTrigger>
<DropdownMenuContent>
Expand Down

0 comments on commit 4f2d257

Please sign in to comment.