Close dropdown and mobile menu when clicking a page link
This commit is contained in:
1 parent
0272da09c1
commit
4ba26fd814
2 files changed
+2
-1
No files matched your search
@@ -62,6 +62,7 @@ export function MobileNav({ children, menuLabel = "Open menu", closeLabel = "Clo
|
|||||||
style={{
|
style={{
|
||||||
borderColor: "color-mix(in srgb, var(--color-text-muted) 10%, transparent)",
|
borderColor: "color-mix(in srgb, var(--color-text-muted) 10%, transparent)",
|
||||||
}}
|
}}
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export function NavDropdown({ label, icon, children }: NavDropdownProps) {
|
|||||||
<svg className={`ml-auto md:ml-1 w-3 h-3 transition-transform duration-200 ${open ? "rotate-180" : ""}`} fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" /></svg>
|
<svg className={`ml-auto md:ml-1 w-3 h-3 transition-transform duration-200 ${open ? "rotate-180" : ""}`} fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" /></svg>
|
||||||
</button>
|
</button>
|
||||||
{open && (
|
{open && (
|
||||||
<div className="dropdown-menu md:absolute left-0 top-full mt-0.5 min-w-[200px] rounded-xl z-50 py-2" role="menu">
|
<div className="dropdown-menu md:absolute left-0 top-full mt-0.5 min-w-[200px] rounded-xl z-50 py-2" role="menu" onClick={() => setOpen(false)}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in new issue
Block a user