Port the Stitch sensing-options design to /sensors with route-based nav, bundled Material Symbols icons, and honest privacy labels in place of mock certifications and scores.
154 lines
4.6 KiB
Vue
154 lines
4.6 KiB
Vue
<script setup lang="ts">
|
|
const route = useRoute()
|
|
const mobileOpen = ref(false)
|
|
const menuButton = ref<HTMLButtonElement | null>(null)
|
|
|
|
const engineActive = computed(() => route.path === '/')
|
|
const sensorsActive = computed(() => route.path.startsWith('/sensors'))
|
|
|
|
const navLinkClass =
|
|
'inline-flex h-16 items-center border-b-2 font-label-md transition-colors'
|
|
const mobileLinkClass = 'inline-flex h-12 items-center justify-center font-label-md transition-colors'
|
|
|
|
function desktopLinkClass(active: boolean) {
|
|
return [
|
|
navLinkClass,
|
|
active
|
|
? 'border-[#00C3CD] text-[#00C3CD] font-semibold'
|
|
: 'border-transparent text-[#94A3B8] hover:text-[#FFFFFF]',
|
|
].join(' ')
|
|
}
|
|
|
|
function mobileLinkClassFor(active: boolean) {
|
|
return [
|
|
mobileLinkClass,
|
|
active ? 'text-[#00C3CD] font-semibold' : 'text-[#94A3B8] hover:text-[#FFFFFF]',
|
|
].join(' ')
|
|
}
|
|
|
|
function closeMenu() {
|
|
mobileOpen.value = false
|
|
}
|
|
|
|
function onKeydown(event: KeyboardEvent) {
|
|
if (event.key === 'Escape' && mobileOpen.value) {
|
|
closeMenu()
|
|
menuButton.value?.focus()
|
|
}
|
|
}
|
|
|
|
function toggleMenu() {
|
|
mobileOpen.value = !mobileOpen.value
|
|
}
|
|
|
|
onMounted(() => window.addEventListener('keydown', onKeydown))
|
|
onBeforeUnmount(() => window.removeEventListener('keydown', onKeydown))
|
|
watch(() => route.fullPath, closeMenu)
|
|
</script>
|
|
|
|
<template>
|
|
<header class="fixed top-0 left-0 right-0 z-50 h-16 bg-[#081723]/95 backdrop-blur-md border-b border-[#1e3a52]">
|
|
<div class="relative h-16 max-w-[1200px] mx-auto px-margin-desktop flex items-center justify-between">
|
|
<NuxtLink
|
|
to="/"
|
|
aria-label="Schwarz Digits — Pulse Engine home"
|
|
class="inline-flex items-center shrink-0"
|
|
>
|
|
<img
|
|
src="/schwarz-digits-logo.svg"
|
|
alt="Schwarz Digits"
|
|
class="h-8 w-auto md:h-9"
|
|
/>
|
|
</NuxtLink>
|
|
|
|
<nav
|
|
aria-label="Primary"
|
|
class="hidden md:flex absolute top-0 left-1/2 -translate-x-1/2 h-16 items-center gap-space-xl"
|
|
>
|
|
<NuxtLink
|
|
to="/"
|
|
:class="desktopLinkClass(engineActive)"
|
|
:aria-current="engineActive ? 'page' : undefined"
|
|
>
|
|
Engine
|
|
</NuxtLink>
|
|
<NuxtLink
|
|
to="/sensors"
|
|
:class="desktopLinkClass(sensorsActive)"
|
|
:aria-current="sensorsActive ? 'page' : undefined"
|
|
>
|
|
Sensors
|
|
</NuxtLink>
|
|
<span
|
|
class="inline-flex h-16 items-center border-b-2 border-transparent font-label-md text-[#94A3B8] cursor-not-allowed"
|
|
aria-disabled="true"
|
|
title="Coming soon"
|
|
>
|
|
Use cases
|
|
</span>
|
|
<span
|
|
class="inline-flex h-16 items-center border-b-2 border-transparent font-label-md text-[#94A3B8] cursor-not-allowed"
|
|
aria-disabled="true"
|
|
title="Coming soon"
|
|
>
|
|
Playground
|
|
</span>
|
|
</nav>
|
|
|
|
<button
|
|
ref="menuButton"
|
|
type="button"
|
|
class="md:hidden inline-flex h-11 w-11 items-center justify-center rounded-lg text-[#94A3B8] hover:text-[#FFFFFF] transition-colors"
|
|
aria-controls="mobile-nav"
|
|
:aria-expanded="mobileOpen"
|
|
:aria-label="mobileOpen ? 'Close menu' : 'Open menu'"
|
|
@click="toggleMenu"
|
|
>
|
|
<Icon v-if="mobileOpen" name="material-symbols:close" class="text-[24px]" />
|
|
<Icon v-else name="material-symbols:menu" class="text-[24px]" />
|
|
</button>
|
|
</div>
|
|
|
|
<div
|
|
v-show="mobileOpen"
|
|
id="mobile-nav"
|
|
class="md:hidden absolute top-full left-0 right-0 bg-[#081723] border-b border-[#1e3a52] shadow-[0_8px_24px_rgba(0,0,0,0.4)]"
|
|
>
|
|
<nav aria-label="Mobile primary" class="max-w-[1200px] mx-auto px-margin-desktop py-space-sm flex flex-col">
|
|
<NuxtLink
|
|
to="/"
|
|
:class="mobileLinkClassFor(engineActive)"
|
|
:aria-current="engineActive ? 'page' : undefined"
|
|
@click="closeMenu"
|
|
>
|
|
Engine
|
|
</NuxtLink>
|
|
<NuxtLink
|
|
to="/sensors"
|
|
:class="mobileLinkClassFor(sensorsActive)"
|
|
:aria-current="sensorsActive ? 'page' : undefined"
|
|
@click="closeMenu"
|
|
>
|
|
Sensors
|
|
</NuxtLink>
|
|
<span
|
|
class="inline-flex h-12 items-center justify-center font-label-md text-[#94A3B8] cursor-not-allowed"
|
|
aria-disabled="true"
|
|
title="Coming soon"
|
|
>
|
|
Use cases
|
|
</span>
|
|
<span
|
|
class="inline-flex h-12 items-center justify-center font-label-md text-[#94A3B8] cursor-not-allowed"
|
|
aria-disabled="true"
|
|
title="Coming soon"
|
|
>
|
|
Playground
|
|
</span>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
|
|
<slot />
|
|
</template>
|