From b0a414972b6a785aa747ce508c94d2b23bdbc46e Mon Sep 17 00:00:00 2001 From: Padreug Date: Tue, 9 Jun 2026 23:31:32 +0200 Subject: [PATCH] feat(header): shadcn Sheet replaces hand-rolled mobile menu Install the shadcn-vue Sheet primitives (Sheet / SheetTrigger / SheetContent / SheetHeader / SheetTitle / SheetDescription / SheetFooter / SheetClose + the sheetVariants cva) at src/components/ui/sheet. Files mirrored from the registry JSON to sidestep the same corepack-pnpm issue that blocks the CLI; X icon import fixed to @lucide/vue. SiteHeader: drop the hand-rolled hamburger that toggled a v-show panel beneath the header, in favour of a Sheet with the hamburger as SheetTrigger (as-child) and the full nav list as SheetContent sliding from the right. Sheet handles open-state via v-model:open, which the route watcher still drives so navigating from the menu auto-closes the panel. SheetContent runs through a Portal at body level so the slide animation isn't constrained by the frosted-glass header. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/SiteHeader.vue | 93 ++++++++++++-------- src/components/ui/sheet/Sheet.vue | 15 ++++ src/components/ui/sheet/SheetClose.vue | 12 +++ src/components/ui/sheet/SheetContent.vue | 53 +++++++++++ src/components/ui/sheet/SheetDescription.vue | 20 +++++ src/components/ui/sheet/SheetFooter.vue | 19 ++++ src/components/ui/sheet/SheetHeader.vue | 16 ++++ src/components/ui/sheet/SheetTitle.vue | 20 +++++ src/components/ui/sheet/SheetTrigger.vue | 12 +++ src/components/ui/sheet/index.ts | 32 +++++++ 10 files changed, 253 insertions(+), 39 deletions(-) create mode 100644 src/components/ui/sheet/Sheet.vue create mode 100644 src/components/ui/sheet/SheetClose.vue create mode 100644 src/components/ui/sheet/SheetContent.vue create mode 100644 src/components/ui/sheet/SheetDescription.vue create mode 100644 src/components/ui/sheet/SheetFooter.vue create mode 100644 src/components/ui/sheet/SheetHeader.vue create mode 100644 src/components/ui/sheet/SheetTitle.vue create mode 100644 src/components/ui/sheet/SheetTrigger.vue create mode 100644 src/components/ui/sheet/index.ts diff --git a/src/components/SiteHeader.vue b/src/components/SiteHeader.vue index c30a993..83afe58 100644 --- a/src/components/SiteHeader.vue +++ b/src/components/SiteHeader.vue @@ -13,6 +13,13 @@ import { NavigationMenuTrigger, navigationMenuTriggerStyle, } from '@/components/ui/navigation-menu' +import { + Sheet, + SheetContent, + SheetHeader, + SheetTitle, + SheetTrigger, +} from '@/components/ui/sheet' const { t, locale } = useI18n() const route = useRoute() @@ -144,45 +151,53 @@ watch(() => route.path, closeMobile) - - - -
-
-
- {{ g.label }} -
- - {{ i.label }} - -
- - {{ t('nav.marketplace') }} - - + + + + + + + + {{ t('nav.menu') }} + + + + +
diff --git a/src/components/ui/sheet/Sheet.vue b/src/components/ui/sheet/Sheet.vue new file mode 100644 index 0000000..47b0968 --- /dev/null +++ b/src/components/ui/sheet/Sheet.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/components/ui/sheet/SheetClose.vue b/src/components/ui/sheet/SheetClose.vue new file mode 100644 index 0000000..0295976 --- /dev/null +++ b/src/components/ui/sheet/SheetClose.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/ui/sheet/SheetContent.vue b/src/components/ui/sheet/SheetContent.vue new file mode 100644 index 0000000..502879c --- /dev/null +++ b/src/components/ui/sheet/SheetContent.vue @@ -0,0 +1,53 @@ + + + diff --git a/src/components/ui/sheet/SheetDescription.vue b/src/components/ui/sheet/SheetDescription.vue new file mode 100644 index 0000000..455c2f4 --- /dev/null +++ b/src/components/ui/sheet/SheetDescription.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/components/ui/sheet/SheetFooter.vue b/src/components/ui/sheet/SheetFooter.vue new file mode 100644 index 0000000..5f481e5 --- /dev/null +++ b/src/components/ui/sheet/SheetFooter.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/components/ui/sheet/SheetHeader.vue b/src/components/ui/sheet/SheetHeader.vue new file mode 100644 index 0000000..f97d24a --- /dev/null +++ b/src/components/ui/sheet/SheetHeader.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/components/ui/sheet/SheetTitle.vue b/src/components/ui/sheet/SheetTitle.vue new file mode 100644 index 0000000..5870787 --- /dev/null +++ b/src/components/ui/sheet/SheetTitle.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/components/ui/sheet/SheetTrigger.vue b/src/components/ui/sheet/SheetTrigger.vue new file mode 100644 index 0000000..a4fc3ee --- /dev/null +++ b/src/components/ui/sheet/SheetTrigger.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/ui/sheet/index.ts b/src/components/ui/sheet/index.ts new file mode 100644 index 0000000..a370633 --- /dev/null +++ b/src/components/ui/sheet/index.ts @@ -0,0 +1,32 @@ +import type { VariantProps } from "class-variance-authority" +import { cva } from "class-variance-authority" + +export { default as Sheet } from "./Sheet.vue" +export { default as SheetClose } from "./SheetClose.vue" +export { default as SheetContent } from "./SheetContent.vue" +export { default as SheetDescription } from "./SheetDescription.vue" +export { default as SheetFooter } from "./SheetFooter.vue" +export { default as SheetHeader } from "./SheetHeader.vue" +export { default as SheetTitle } from "./SheetTitle.vue" +export { default as SheetTrigger } from "./SheetTrigger.vue" + +export const sheetVariants = cva( + "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", + { + variants: { + side: { + top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", + bottom: + "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", + left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", + right: + "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, + }, +) + +export type SheetVariants = VariantProps