11<script setup lang="ts">
2- import { Link , usePage } from ' @inertiajs/vue3'
3- import type { BreadcrumbItem , NavItem } from ' @/types'
4- import AppLogo from ' @/components/AppLogo.vue'
5- import AppLogoIcon from ' @/components/AppLogoIcon.vue'
6- import { Button } from " @/components/ui/button"
7- import {
8- DropdownMenu ,
9- DropdownMenuContent ,
10- DropdownMenuTrigger ,
11- } from ' @/components/ui/dropdown-menu'
12- import {
13- Tooltip ,
14- TooltipContent ,
15- TooltipProvider ,
16- TooltipTrigger ,
17- } from ' @/components/ui/tooltip'
18- import {
19- Sheet ,
20- SheetContent ,
21- SheetHeader ,
22- SheetTrigger ,
23- } from ' @/components/ui/sheet'
2+ import AppLogo from ' @/components/AppLogo.vue' ;
3+ import AppLogoIcon from ' @/components/AppLogoIcon.vue' ;
4+ import UserMenuContent from ' @/components/UserMenuContent.vue' ;
5+ import { Button } from ' @/components/ui/button' ;
6+ import { DropdownMenu , DropdownMenuContent , DropdownMenuTrigger } from ' @/components/ui/dropdown-menu' ;
247import {
258 NavigationMenu ,
269 NavigationMenuItem ,
2710 NavigationMenuLink ,
2811 NavigationMenuList ,
2912 navigationMenuTriggerStyle ,
30- } from ' @/components/ui/navigation-menu'
31- import { BookOpenText , ChevronDown , FolderGit2 , LayoutGrid , Menu , Search } from ' lucide-vue-next'
32- import UserMenuContent from ' @/components/UserMenuContent.vue'
33- import { getInitials } from ' @/composables/useInitials'
34- import { computed } from ' vue'
13+ } from ' @/components/ui/navigation-menu' ;
14+ import { Sheet , SheetContent , SheetHeader , SheetTrigger } from ' @/components/ui/sheet' ;
15+ import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from ' @/components/ui/tooltip' ;
16+ import { getInitials } from ' @/composables/useInitials' ;
17+ import type { BreadcrumbItem , NavItem } from ' @/types' ;
18+ import { Link , usePage } from ' @inertiajs/vue3' ;
19+ import { BookOpenText , ChevronDown , FolderGit2 , LayoutGrid , Menu , Search } from ' lucide-vue-next' ;
20+ import { computed } from ' vue' ;
3521
3622interface Props {
37- breadcrumbs? : BreadcrumbItem []
23+ breadcrumbs? : BreadcrumbItem [];
3824}
3925
4026const props = withDefaults (defineProps <Props >(), {
41- breadcrumbs : () => []
42- })
27+ breadcrumbs : () => [],
28+ });
4329
44- const page = usePage ()
45- const auth = computed (() => page .props .auth )
30+ const page = usePage ();
31+ const auth = computed (() => page .props .auth );
4632
4733const isCurrentRoute = (url : string ) => {
48- return page .url === url
49- }
34+ return page .url === url ;
35+ };
5036
51- const activeItemStyles = computed (() => ( url : string ) =>
52- isCurrentRoute (url ) ? ' bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ' '
53- )
37+ const activeItemStyles = computed (
38+ () => ( url : string ) => ( isCurrentRoute (url ) ? ' bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ' ' ),
39+ );
5440
5541const mainNavItems: NavItem [] = [
5642 {
@@ -77,13 +63,12 @@ const rightNavItems: NavItem[] = [
7763<template >
7864 <div >
7965 <div class =" border-b border-sidebar-border/80" >
80- <div class =" flex h-16 items-center px-4 md:max-w-7xl mx-auto " >
66+ <div class =" mx-auto flex h-16 items-center px-4 md:max-w-7xl" >
8167 <!-- Mobile Menu -->
8268 <div class =" lg:hidden" >
83-
8469 <Sheet >
8570 <SheetTrigger :as-child =" true" >
86- <Button variant =" ghost" size =" icon" class =" w-9 h-9 mr-2 " >
71+ <Button variant =" ghost" size =" icon" class =" mr-2 h-9 w-9 " >
8772 <Menu class =" h-5 w-5" />
8873 </Button >
8974 </SheetTrigger >
@@ -93,7 +78,7 @@ const rightNavItems: NavItem[] = [
9378 <AppLogoIcon class =" size-6 fill-current text-black dark:text-white" />
9479 </SheetHeader >
9580 <div className =" flex flex-col justify-between h-full space-y-4 py-6 flex-1" >
96- <nav class =" space-y-1 -mx-3 " >
81+ <nav class =" -mx-3 space-y-1 " >
9782 <Link
9883 v-for =" item in mainNavItems"
9984 :key =" item.title"
@@ -112,7 +97,7 @@ const rightNavItems: NavItem[] = [
11297 :href =" item.url"
11398 target =" _blank"
11499 rel =" noopener noreferrer"
115- class =" flex items-center text-sm space-x-2 font-medium"
100+ class =" flex items-center space-x-2 text-sm font-medium"
116101 >
117102 <component v-if =" item.icon" :is =" item.icon" class =" h-5 w-5" />
118103 <span >{{ item.title }}</span >
@@ -128,10 +113,8 @@ const rightNavItems: NavItem[] = [
128113 </Link >
129114
130115 <!-- Desktop Menu -->
131- <div class =" hidden lg:flex lg:flex-1 h-full" >
132-
133-
134- <NavigationMenu class =" flex h-full items-stretch ml-10" >
116+ <div class =" hidden h-full lg:flex lg:flex-1" >
117+ <NavigationMenu class =" ml-10 flex h-full items-stretch" >
135118 <NavigationMenuList class =" flex h-full items-stretch space-x-2" >
136119 <NavigationMenuItem v-for =" (item, index) in mainNavItems" :key =" index" class =" relative flex h-full items-center" >
137120 <Link :href =" item.url" >
@@ -146,12 +129,11 @@ const rightNavItems: NavItem[] = [
146129 </NavigationMenuItem >
147130 </NavigationMenuList >
148131 </NavigationMenu >
149-
150132 </div >
151133
152134 <div class =" ml-auto flex items-center space-x-2" >
153135 <div class =" relative flex items-center space-x-1" >
154- <Button variant =" ghost" size =" icon" class =" w -9 h -9 cursor-pointer" >
136+ <Button variant =" ghost" size =" icon" class =" h -9 w -9 cursor-pointer" >
155137 <Search class =" h-5 w-5" />
156138 </Button >
157139
@@ -178,24 +160,18 @@ const rightNavItems: NavItem[] = [
178160
179161 <DropdownMenu >
180162 <DropdownMenuTrigger :as-child =" true" >
181- <Button
182- variant =" ghost"
183- size =" icon"
184- class =" relative h-9 w-auto px-1 rounded-md"
185- >
186- <span ><img
187- v-if =" auth.user?.avatar"
188- :src =" auth.user.avatar"
189- :alt =" auth.user.name"
190- class =" rounded-full"
191- />
192- <span v-else class =" flex h-7 w-7 items-center justify-center rounded-md bg-primary/10 text-sm font-medium text-primary" >
193- {{ getInitials(auth.user?.name) }}
194- </span >
163+ <Button variant =" ghost" size =" icon" class =" relative h-9 w-auto rounded-md px-1" >
164+ <span
165+ ><img v-if =" auth.user?.avatar" :src =" auth.user.avatar" :alt =" auth.user.name" class =" rounded-full" />
166+ <span
167+ v-else
168+ class =" flex h-7 w-7 items-center justify-center rounded-md bg-primary/10 text-sm font-medium text-primary"
169+ >
170+ {{ getInitials(auth.user?.name) }}
171+ </span >
195172 </span >
196- <ChevronDown class =" ml-auto size-4 mr-1" />
173+ <ChevronDown class =" ml-auto mr-1 size-4 " />
197174 </Button >
198-
199175 </DropdownMenuTrigger >
200176 <DropdownMenuContent align =" end" class =" w-56" >
201177 <UserMenuContent :user =" auth.user" />
@@ -204,10 +180,10 @@ const rightNavItems: NavItem[] = [
204180 </div >
205181 </div >
206182 </div >
207- <div v-if =" props.breadcrumbs.length > 1" class =" w-full flex border-b border-sidebar-border/70" >
208- <div class =" flex h-12 items-center justify-start w-full px-4 md:max-w-7xl mx-auto text-neutral-500 " >
183+ <div v-if =" props.breadcrumbs.length > 1" class =" flex w-full border-b border-sidebar-border/70" >
184+ <div class =" mx-auto flex h-12 w-full items-center justify-start px-4 text-neutral-500 md:max-w-7xl" >
209185 <Breadcrumbs :breadcrumbs =" props.breadcrumbs" />
210186 </div >
211187 </div >
212188 </div >
213- </template >
189+ </template >
0 commit comments