diff --git a/src/components/navbar.astro b/src/components/navbar.astro index 8cc5d56..7d1bdd1 100644 --- a/src/components/navbar.astro +++ b/src/components/navbar.astro @@ -109,12 +109,12 @@ const hamburger_src_url = `url("${hamburger.src}")`; .hamburger-menu { mask: var(--hamburger_src_url) no-repeat center; background-color: white; - width: 2em; - height: 2em; + width: 2rem; + height: 2rem; position: static; align-self: flex-start; - padding-right: 1rem; - padding-top: 2rem; + margin-right: 1rem; + margin-top: 1rem; } @media (min-width: 1140px) { diff --git a/src/components/navbarEntryDesktop.astro b/src/components/navbarEntry.astro similarity index 87% rename from src/components/navbarEntryDesktop.astro rename to src/components/navbarEntry.astro index 2ebb3f4..8322b66 100644 --- a/src/components/navbarEntryDesktop.astro +++ b/src/components/navbarEntry.astro @@ -1,12 +1,13 @@ --- export interface Props { currentPage?: string + navtype: "mobile" | "desktop" link: string text: string icon: ImageMetadata } -const { icon, text, link, currentPage } = Astro.props +const { icon, text, link, navtype, currentPage } = Astro.props let currPage = '' const slug = link.replace(new RegExp('/', 'g'), '') @@ -20,6 +21,7 @@ if (currentPage === slug) { const icon_src_url = `url("${icon.src}")`; const fulllink = `/${slug}` +let extraattributes = navtype === "mobile" ? { tabindex: "0"} : {} ---
  • @@ -29,6 +31,7 @@ const fulllink = `/${slug}` aria-label={text} class={currPage} role="menuitem" + {...extraattributes} >
    {text} diff --git a/src/components/navbarEntryMobile.astro b/src/components/navbarEntryMobile.astro deleted file mode 100644 index 175ff83..0000000 --- a/src/components/navbarEntryMobile.astro +++ /dev/null @@ -1,81 +0,0 @@ ---- -export interface Props { - currentPage?: string - link: string - text: string - icon: ImageMetadata -} - -const { icon, text, link, currentPage } = Astro.props - -let currPage = '' -const slug = link.replace(new RegExp('/', 'g'), '') - -if (currentPage === slug) { - currPage = 'current' -} else if (currentPage === 'home' && link === '/') { - currPage = 'current' -} - -const icon_src_url = `url("${icon.src}")`; -const fulllink = `/${slug}` ---- - -
  • - -
    - {text} -
    -
  • - - diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 8536cad..09d6182 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -1,7 +1,6 @@ --- import Navbar from '../components/navbar.astro' -import NavbarEntryDesktop from '../components/navbarEntryDesktop.astro' -import NavbarEntryMobile from '../components/navbarEntryMobile.astro' +import NavbarEntry from '../components/navbarEntry.astro' import navdata from '../../static/data/_navdata.json' import embed from '../assets/embed.png' @@ -78,12 +77,12 @@ const mapped_navdata = navdata.map((item) => ({ { mapped_navdata.map((item) => ( - + )) } { mapped_navdata.map((item) => ( - + )) }