Skip to content

Commit ef2c4c8

Browse files
authored
refactor: simplify prop usage in Vue components (#15)
This change removes unnecessary `props` destructuring in Vue components and directly uses the props where applicable. This improves code readability and consistency across the codebase. No breaking changes are introduced as the functionality remains the same.
1 parent 030a3df commit ef2c4c8

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

resources/js/components/AppHeader.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const rightNavItems: NavItem[] = [
182182

183183
<div v-if="props.breadcrumbs.length > 1" class="flex w-full border-b border-sidebar-border/70">
184184
<div class="mx-auto flex h-12 w-full items-center justify-start px-4 text-neutral-500 md:max-w-7xl">
185-
<Breadcrumbs :breadcrumbs="props.breadcrumbs" />
185+
<Breadcrumbs :breadcrumbs="breadcrumbs" />
186186
</div>
187187
</div>
188188
</div>

resources/js/components/AppearanceTabs.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface Props {
66
class?: string;
77
}
88
9-
const props = withDefaults(defineProps<Props>(), {
9+
const { class: containerClass } = withDefaults(defineProps<Props>(), {
1010
class: '',
1111
});
1212
@@ -20,7 +20,7 @@ const tabs = [
2020
</script>
2121

2222
<template>
23-
<div :class="['inline-flex gap-1 rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800', props.class]">
23+
<div :class="['inline-flex gap-1 rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800', containerClass]">
2424
<button
2525
v-for="{ value, Icon, label } in tabs"
2626
:key="value"

resources/js/components/Icon.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ const icon = computed(() => {
2626
</script>
2727

2828
<template>
29-
<component :is="icon" :class="className" :size="props.size" :stroke-width="props.strokeWidth" :color="props.color" />
29+
<component :is="icon" :class="className" :size="size" :stroke-width="strokeWidth" :color="color" />
3030
</template>

resources/js/layouts/AppLayout.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ interface Props {
66
breadcrumbs?: BreadcrumbItemType[];
77
}
88
9-
const props = withDefaults(defineProps<Props>(), {
9+
withDefaults(defineProps<Props>(), {
1010
breadcrumbs: () => [],
1111
});
1212
</script>
1313

1414
<template>
15-
<AppLayout :breadcrumbs="props.breadcrumbs">
15+
<AppLayout :breadcrumbs="breadcrumbs">
1616
<slot />
1717
</AppLayout>
1818
</template>

resources/js/layouts/app/AppHeaderLayout.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ interface Props {
88
breadcrumbs?: BreadcrumbItemType[];
99
}
1010
11-
const props = withDefaults(defineProps<Props>(), {
11+
withDefaults(defineProps<Props>(), {
1212
breadcrumbs: () => [],
1313
});
1414
</script>
1515

1616
<template>
1717
<AppShell class="flex-col">
18-
<AppHeader :breadcrumbs="props.breadcrumbs" />
18+
<AppHeader :breadcrumbs="breadcrumbs" />
1919
<AppContent>
2020
<slot />
2121
</AppContent>

resources/js/layouts/app/AppSidebarLayout.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface Props {
99
breadcrumbs?: BreadcrumbItemType[];
1010
}
1111
12-
const props = withDefaults(defineProps<Props>(), {
12+
withDefaults(defineProps<Props>(), {
1313
breadcrumbs: () => [],
1414
});
1515
</script>
@@ -18,7 +18,7 @@ const props = withDefaults(defineProps<Props>(), {
1818
<AppShell variant="sidebar">
1919
<AppSidebar />
2020
<AppContent variant="sidebar">
21-
<AppSidebarHeader :breadcrumbs="props.breadcrumbs" />
21+
<AppSidebarHeader :breadcrumbs="breadcrumbs" />
2222
<slot />
2323
</AppContent>
2424
</AppShell>

0 commit comments

Comments
 (0)