fix: mobile menu

This commit is contained in:
ner committed 2024-03-22 14:28:49 +02:00
1 parent 84a631b56a
commit cd8928ab54
6 files changed
+54 -23

No files matched your search

@@ -1,5 +1,6 @@
'use client';
import { useState } from 'react';
import { Menu } from 'lucide-react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
@@ -31,11 +32,12 @@ interface Props {
}
export function NavigationSmall({ className }: Props) {
const [isOpen, setIsOpen] = useState(false);
const currentPath = usePathname();
return (
<div className={className}>
<DropdownMenu>
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
<DropdownMenuTrigger asChild>
<Button variant='ghost' size='icon'>
<Menu size={19} />
@@ -45,7 +47,9 @@ export function NavigationSmall({ className }: Props) {
<DropdownMenuRadioGroup value={currentPath}>
{paths.map(({ path, title }) => (
<Link href={path} legacyBehavior shallow key={path}>
<DropdownMenuRadioItem value={path}>{title}</DropdownMenuRadioItem>
<DropdownMenuRadioItem value={path} onClick={() => setIsOpen(false)}>
{title}
</DropdownMenuRadioItem>
</Link>
))}
</DropdownMenuRadioGroup>