Files
archie/ui/src/components/topbar/Nav.vue
T
sam 8ea5ad6faf fix(ui): burger section sheet at phone width, 36px control scale
The coarse-pointer rule gave every button, link and field a 44px minimum on
touch, which made the phone dashboard look like a toy and pushed the section
strip into overlapping its neighbours. Controls now keep their own size, and
the shared ladder is one step taller (default 36px, sm 32px) so a finger still
hits something. Inputs stay 16px only where iOS would zoom.

Below md the sections move into a sheet with the current page marked; the bar
keeps brand, search, alerts and the operator. Page titles drop to 18px so the
title and its action sit on one centred line.
2026-10-18 22:29:25 +11:00

46 lines
1.6 KiB
Vue

<script setup lang="ts">
import { computed, onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
const props = defineProps<{ hidden: string[] }>();
const route = useRoute();
const root = ref<HTMLElement | null>(null);
const links = computed(() =>
navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : [])),
);
const activePath = computed(() => activeNavPath(route.path));
// The strip scrolls sideways on a narrow window, so the current section can sit
// outside it. Centre it after each route change; block:"nearest" keeps it from
// scrolling the page too.
function revealActive(): void {
root.value
?.querySelector('[aria-current="page"]')
?.scrollIntoView({ inline: "center", block: "nearest" });
}
onMounted(revealActive);
watch(activePath, revealActive, { flush: "post" });
</script>
<template>
<nav
ref="root"
aria-label="Sections"
class="flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]"
>
<RouterLink
v-for="entry in links"
:key="entry.path"
:to="entry.path"
:aria-current="activePath === entry.path ? 'page' : undefined"
:data-current="activePath === entry.path ? '' : undefined"
class="text-fg-muted hover:text-foreground hover:bg-accent data-current:text-foreground data-current:bg-accent focus-visible:ring-ring/50 inline-flex h-8 shrink-0 items-center rounded-md px-2.5 text-sm font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-[3px]"
>{{ entry.label }}</RouterLink
>
</nav>
</template>