Skip to content

Commit 6d8ec73

Browse files
committed
cleanup of vue starter kit
1 parent a2654a8 commit 6d8ec73

File tree

6 files changed

+35
-9
lines changed

6 files changed

+35
-9
lines changed

resources/js/layouts/AppLayout.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
BreadcrumbPage,
1010
BreadcrumbSeparator,
1111
} from '@/components/ui/breadcrumb';
12+
import { type BreadcrumbItemType } from '@/types'
1213
import { Separator } from '@/components/ui/separator';
1314
import {
1415
SidebarInset,
@@ -22,14 +23,14 @@ interface BreadcrumbItem {
2223
}
2324
2425
interface Props {
25-
breadcrumbItems?: BreadcrumbItem[];
26+
breadcrumbs?: BreadcrumbItemType[];
2627
}
2728
2829
const props = withDefaults(defineProps<Props>(), {
29-
breadcrumbItems: () => [],
30+
breadcrumbs: () => [],
3031
});
3132
32-
const isOpen = ref(localStorage.getItem('sidebar') === 'true' ?? true);
33+
const isOpen = ref(localStorage.getItem('sidebar') === 'true');
3334
3435
const handleSidebarChange = (open: boolean) => {
3536
isOpen.value = open;
@@ -48,13 +49,13 @@ const handleSidebarChange = (open: boolean) => {
4849
<header class="flex h-16 shrink-0 items-center w-full justify-between gap-2 border-b px-4">
4950
<div class="flex items-center gap-2">
5051
<SidebarTrigger class="-ml-1" />
51-
<template v-if="breadcrumbItems.length > 0">
52+
<template v-if="breadcrumbs.length > 0">
5253
<Separator orientation="vertical" class="mr-2 h-4" />
5354
<Breadcrumb>
5455
<BreadcrumbList>
55-
<template v-for="(item, index) in breadcrumbItems" :key="index">
56+
<template v-for="(item, index) in breadcrumbs" :key="index">
5657
<BreadcrumbItem>
57-
<template v-if="index === breadcrumbItems.length - 1">
58+
<template v-if="index === breadcrumbs.length - 1">
5859
<BreadcrumbPage>{{ item.title }}</BreadcrumbPage>
5960
</template>
6061
<template v-else>
@@ -63,7 +64,7 @@ const handleSidebarChange = (open: boolean) => {
6364
</BreadcrumbLink>
6465
</template>
6566
</BreadcrumbItem>
66-
<BreadcrumbSeparator v-if="index !== breadcrumbItems.length - 1" />
67+
<BreadcrumbSeparator v-if="index !== breadcrumbs.length - 1" />
6768
</template>
6869
</BreadcrumbList>
6970
</Breadcrumb>

resources/js/pages/Dashboard.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script setup lang="ts">
22
import AppLayout from '@/layouts/AppLayout.vue';
3+
import { type BreadcrumbItemType } from '@/types'
34
import { Head } from '@inertiajs/vue3';
45
56
interface BreadcrumbItem {
67
title: string;
78
href: string;
89
}
910
10-
const breadcrumbItems: BreadcrumbItem[] = [
11+
const breadcrumbs: BreadcrumbItemType[] = [
1112
{
1213
title: 'Dashboard',
1314
href: '/dashboard'
@@ -22,7 +23,7 @@ defineProps<{
2223
<template>
2324
<Head title="Dashboard" />
2425

25-
<AppLayout :breadcrumb-items="breadcrumbItems">
26+
<AppLayout :breadcrumbs="breadcrumbs">
2627
<div class="flex flex-1 flex-col gap-4 p-4">
2728
<div class="grid auto-rows-min gap-4 md:grid-cols-3">
2829
<div class="aspect-video rounded-xl bg-muted/50" />
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface BreadcrumbItemType {
2+
title: string
3+
href: string
4+
}

resources/js/types/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './breadcrumb.types'
2+
export * from './nav.types'
3+
export * from './user.types'

resources/js/types/nav.types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { LucideIcon } from 'lucide-react'
2+
3+
export interface NavItemType {
4+
title: string
5+
url: string
6+
icon?: LucideIcon|null
7+
isActive?: boolean
8+
}

resources/js/types/user.types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface UserType {
2+
id: number
3+
name: string
4+
email: string
5+
email_verified_at: string | null
6+
created_at: string
7+
updated_at: string
8+
[key: string]: any // This allows for additional properties
9+
}

0 commit comments

Comments
 (0)