Skip to content

Commit fe8ce79

Browse files
authored
Rename url to href in navigation items for consistency (#17)
* fix: correct className to class in AppHeader.vue The className attribute was incorrectly used in the Vue template, which caused styling issues. This change replaces className with the correct class attribute to ensure proper styling and alignment with Vue's syntax. No breaking changes are introduced. * refactor: Rename `url` to `href` in navigation items for consistency This change renames the `url` property to `href` across all navigation-related components (NavFooter, AppHeader, AppSidebar) to maintain consistency in naming conventions. The update ensures uniformity in the codebase and aligns with standard HTML attribute naming practices. No breaking changes are introduced as the functionality remains the same.
1 parent 5172942 commit fe8ce79

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

resources/js/components/AppHeader.vue

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
NavigationMenuList,
1212
navigationMenuTriggerStyle,
1313
} from '@/components/ui/navigation-menu';
14-
import { Sheet, SheetContent, SheetHeader, SheetTrigger } from '@/components/ui/sheet';
14+
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet';
1515
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
1616
import UserMenuContent from '@/components/UserMenuContent.vue';
1717
import { getInitials } from '@/composables/useInitials';
@@ -40,20 +40,20 @@ const activeItemStyles = computed(() => (url: string) => (isCurrentRoute(url) ?
4040
const mainNavItems: NavItem[] = [
4141
{
4242
title: 'Dashboard',
43-
url: '/dashboard',
43+
href: '/dashboard',
4444
icon: LayoutGrid,
4545
},
4646
];
4747
4848
const rightNavItems: NavItem[] = [
4949
{
5050
title: 'Repository',
51-
url: 'https://github.com/laravel/vue-starter-kit',
51+
href: 'https://github.com/laravel/vue-starter-kit',
5252
icon: Folder,
5353
},
5454
{
5555
title: 'Documentation',
56-
url: 'https://laravel.com/docs/starter-kits',
56+
href: 'https://laravel.com/docs/starter-kits',
5757
icon: BookOpen,
5858
},
5959
];
@@ -81,9 +81,9 @@ const rightNavItems: NavItem[] = [
8181
<Link
8282
v-for="item in mainNavItems"
8383
:key="item.title"
84-
:href="item.url"
84+
:href="item.href"
8585
class="flex items-center gap-x-3 rounded-lg px-3 py-2 text-sm font-medium hover:bg-accent"
86-
:class="activeItemStyles(item.url)"
86+
:class="activeItemStyles(item.href)"
8787
>
8888
<component v-if="item.icon" :is="item.icon" class="h-5 w-5" />
8989
{{ item.title }}
@@ -93,7 +93,7 @@ const rightNavItems: NavItem[] = [
9393
<a
9494
v-for="item in rightNavItems"
9595
:key="item.title"
96-
:href="item.url"
96+
:href="item.href"
9797
target="_blank"
9898
rel="noopener noreferrer"
9999
class="flex items-center space-x-2 text-sm font-medium"
@@ -116,9 +116,9 @@ const rightNavItems: NavItem[] = [
116116
<NavigationMenu class="ml-10 flex h-full items-stretch">
117117
<NavigationMenuList class="flex h-full items-stretch space-x-2">
118118
<NavigationMenuItem v-for="(item, index) in mainNavItems" :key="index" class="relative flex h-full items-center">
119-
<Link :href="item.url">
119+
<Link :href="item.href">
120120
<NavigationMenuLink
121-
:class="[navigationMenuTriggerStyle(), activeItemStyles(item.url), 'h-9 cursor-pointer px-3']"
121+
:class="[navigationMenuTriggerStyle(), activeItemStyles(item.href), 'h-9 cursor-pointer px-3']"
122122
>
123123
<component v-if="item.icon" :is="item.icon" class="mr-2 h-4 w-4" />
124124
{{ item.title }}
@@ -142,7 +142,7 @@ const rightNavItems: NavItem[] = [
142142
<Tooltip>
143143
<TooltipTrigger>
144144
<Button variant="ghost" size="icon" as-child class="group h-9 w-9 cursor-pointer">
145-
<a :href="item.url" target="_blank" rel="noopener noreferrer">
145+
<a :href="item.href" target="_blank" rel="noopener noreferrer">
146146
<span class="sr-only">{{ item.title }}</span>
147147
<component :is="item.icon" class="size-5 opacity-80 group-hover:opacity-100" />
148148
</a>

resources/js/components/AppSidebar.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ import AppLogo from './AppLogo.vue';
1111
const mainNavItems: NavItem[] = [
1212
{
1313
title: 'Dashboard',
14-
url: '/dashboard',
14+
href: '/dashboard',
1515
icon: LayoutGrid,
1616
},
1717
];
1818
1919
const footerNavItems: NavItem[] = [
2020
{
2121
title: 'Github Repo',
22-
url: 'https://github.com/laravel/vue-starter-kit',
22+
href: 'https://github.com/laravel/vue-starter-kit',
2323
icon: Folder,
2424
},
2525
{
2626
title: 'Documentation',
27-
url: 'https://laravel.com/docs/starter-kits',
27+
href: 'https://laravel.com/docs/starter-kits',
2828
icon: BookOpen,
2929
},
3030
];

resources/js/components/NavFooter.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ defineProps<Props>();
1616
<SidebarMenu>
1717
<SidebarMenuItem v-for="item in items" :key="item.title">
1818
<SidebarMenuButton class="text-neutral-600 hover:text-neutral-800 dark:text-neutral-300 dark:hover:text-neutral-100" as-child>
19-
<a :href="item.url" target="_blank" rel="noopener noreferrer">
19+
<a :href="item.href" target="_blank" rel="noopener noreferrer">
2020
<component :is="item.icon" />
2121
<span>{{ item.title }}</span>
2222
</a>

0 commit comments

Comments
 (0)