mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-11 18:56:06 +09:00
Merge pull request #76 from victor-arango/fix/mobile-nav-menu
fix(nav): enable menu expansion and click support on mobile
This commit is contained in:
@@ -55,7 +55,13 @@ const { pathname } = Astro.url;
|
|||||||
<>
|
<>
|
||||||
{menu.hasChildren ? (
|
{menu.hasChildren ? (
|
||||||
<li class="nav-item nav-dropdown group relative">
|
<li class="nav-item nav-dropdown group relative">
|
||||||
<span
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
id={`submenu-${menu.name}`}
|
||||||
|
class="peer hidden lg:hidden"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for={`submenu-${menu.name}`}
|
||||||
class={`nav-link inline-flex items-center ${
|
class={`nav-link inline-flex items-center ${
|
||||||
menu.children?.map(({ url }) => url).includes(pathname) ||
|
menu.children?.map(({ url }) => url).includes(pathname) ||
|
||||||
menu.children
|
menu.children
|
||||||
@@ -69,8 +75,8 @@ const { pathname } = Astro.url;
|
|||||||
<svg class="h-4 w-4 fill-current" viewBox="0 0 20 20">
|
<svg class="h-4 w-4 fill-current" viewBox="0 0 20 20">
|
||||||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
|
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</label>
|
||||||
<ul class="nav-dropdown-list hidden group-hover:block lg:invisible lg:absolute lg:block lg:opacity-0 lg:group-hover:visible lg:group-hover:opacity-100">
|
<ul class=" hidden peer-checked:block lg:invisible lg:absolute lg:block lg:opacity-0 lg:group-hover:visible lg:group-hover:opacity-100">
|
||||||
{menu.children?.map((child) => (
|
{menu.children?.map((child) => (
|
||||||
<li class="nav-dropdown-item">
|
<li class="nav-dropdown-item">
|
||||||
<a
|
<a
|
||||||
|
|||||||
Reference in New Issue
Block a user