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.
This commit is contained in:
1 parent
0d4b83862c
commit
8ea5ad6faf
16 files changed
+88
-49
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, watch } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
|
||||
@@ -7,6 +7,7 @@ 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] : [])),
|
||||
);
|
||||
@@ -16,8 +17,8 @@ const activePath = computed(() => activeNavPath(route.path));
|
||||
// outside it. Centre it after each route change; block:"nearest" keeps it from
|
||||
// scrolling the page too.
|
||||
function revealActive(): void {
|
||||
document
|
||||
.querySelector('nav[aria-label="Sections"] [aria-current="page"]')
|
||||
root.value
|
||||
?.querySelector('[aria-current="page"]')
|
||||
?.scrollIntoView({ inline: "center", block: "nearest" });
|
||||
}
|
||||
|
||||
@@ -27,6 +28,7 @@ watch(activePath, revealActive, { flush: "post" });
|
||||
|
||||
<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]"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { Menu } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet";
|
||||
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
|
||||
|
||||
/** The section list at phone width, where the strip has no room to show a
|
||||
* label beside the current page. Sheet rather than a dropdown: it traps focus,
|
||||
* takes the full height of a short screen, and holds rows a finger can hit. */
|
||||
const props = defineProps<{ hidden: string[] }>();
|
||||
|
||||
const route = useRoute();
|
||||
const open = ref(false);
|
||||
const links = computed(() =>
|
||||
navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : [])),
|
||||
);
|
||||
const activePath = computed(() => activeNavPath(route.path));
|
||||
|
||||
watch(() => route.path, () => (open.value = false));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Sheet v-model:open="open">
|
||||
<SheetTrigger as-child>
|
||||
<Button variant="ghost" size="icon" aria-label="Sections">
|
||||
<Menu aria-hidden="true" />
|
||||
</Button>
|
||||
</SheetTrigger>
|
||||
<SheetContent side="left" class="w-64 gap-0 p-0">
|
||||
<SheetHeader class="border-b px-4 py-3">
|
||||
<SheetTitle class="text-sm">Sections</SheetTitle>
|
||||
</SheetHeader>
|
||||
<nav aria-label="Sections" class="flex flex-col gap-0.5 p-2">
|
||||
<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 flex h-11 items-center rounded-md px-3 text-sm font-medium transition-colors outline-none focus-visible:ring-[3px]"
|
||||
>{{ entry.label }}</RouterLink
|
||||
>
|
||||
</nav>
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
</template>
|
||||
@@ -6,6 +6,7 @@ import NewTaskDialog from "@/tasks/NewTaskDialog.vue";
|
||||
import Brand from "./Brand.vue";
|
||||
import ConnectionPill from "./ConnectionPill.vue";
|
||||
import Nav from "./Nav.vue";
|
||||
import NavMenu from "./NavMenu.vue";
|
||||
import ProfileDropdown from "./ProfileDropdown.vue";
|
||||
|
||||
const props = defineProps<{ hidden: string[] }>();
|
||||
@@ -16,9 +17,13 @@ const newTaskOpen = ref(false);
|
||||
<header
|
||||
class="bg-background/80 sticky top-0 z-40 flex h-14 items-center gap-3 border-b px-3 backdrop-blur-xl sm:px-4"
|
||||
>
|
||||
<div class="md:hidden"><NavMenu :hidden="props.hidden" /></div>
|
||||
<Brand />
|
||||
<Nav :hidden="props.hidden" />
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<!-- Below md the strip cannot show a label beside the current page, so the
|
||||
sheet carries the sections and the bar keeps brand, search, alerts and
|
||||
the operator. -->
|
||||
<div class="min-w-0 flex-1 max-md:hidden"><Nav :hidden="props.hidden" /></div>
|
||||
<div class="ml-auto flex shrink-0 items-center gap-2">
|
||||
<ConnectionPill />
|
||||
<CommandPalette :hidden="props.hidden" @new-task="newTaskOpen = true" />
|
||||
<NewTaskDialog v-if="!props.hidden.includes('/workflows')" v-model:open="newTaskOpen" />
|
||||
|
||||
Reference in new issue
Block a user