Skip to content

Commit 330b5ce

Browse files
authored
refactor: rename NavItem property url to href (#73)
1 parent 01805e5 commit 330b5ce

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

resources/js/components/app-header.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ import AppLogoIcon from './app-logo-icon';
1818
const mainNavItems: NavItem[] = [
1919
{
2020
title: 'Dashboard',
21-
url: '/dashboard',
21+
href: '/dashboard',
2222
icon: LayoutGrid,
2323
},
2424
];
2525

2626
const rightNavItems: NavItem[] = [
2727
{
2828
title: 'Repository',
29-
url: 'https://github.com/laravel/react-starter-kit',
29+
href: 'https://github.com/laravel/react-starter-kit',
3030
icon: Folder,
3131
},
3232
{
3333
title: 'Documentation',
34-
url: 'https://laravel.com/docs/starter-kits',
34+
href: 'https://laravel.com/docs/starter-kits',
3535
icon: BookOpen,
3636
},
3737
];
@@ -67,7 +67,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
6767
<div className="flex h-full flex-col justify-between text-sm">
6868
<div className="flex flex-col space-y-4">
6969
{mainNavItems.map((item) => (
70-
<Link key={item.title} href={item.url} className="flex items-center space-x-2 font-medium">
70+
<Link key={item.title} href={item.href} className="flex items-center space-x-2 font-medium">
7171
{item.icon && <Icon iconNode={item.icon} className="h-5 w-5" />}
7272
<span>{item.title}</span>
7373
</Link>
@@ -78,7 +78,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
7878
{rightNavItems.map((item) => (
7979
<a
8080
key={item.title}
81-
href={item.url}
81+
href={item.href}
8282
target="_blank"
8383
rel="noopener noreferrer"
8484
className="flex items-center space-x-2 font-medium"
@@ -105,17 +105,17 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
105105
{mainNavItems.map((item, index) => (
106106
<NavigationMenuItem key={index} className="relative flex h-full items-center">
107107
<Link
108-
href={item.url}
108+
href={item.href}
109109
className={cn(
110110
navigationMenuTriggerStyle(),
111-
page.url === item.url && activeItemStyles,
111+
page.url === item.href && activeItemStyles,
112112
'h-9 cursor-pointer px-3',
113113
)}
114114
>
115115
{item.icon && <Icon iconNode={item.icon} className="mr-2 h-4 w-4" />}
116116
{item.title}
117117
</Link>
118-
{page.url === item.url && (
118+
{page.url === item.href && (
119119
<div className="absolute bottom-0 left-0 h-0.5 w-full translate-y-px bg-black dark:bg-white"></div>
120120
)}
121121
</NavigationMenuItem>
@@ -135,7 +135,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
135135
<Tooltip>
136136
<TooltipTrigger>
137137
<a
138-
href={item.url}
138+
href={item.href}
139139
target="_blank"
140140
rel="noopener noreferrer"
141141
className="group text-accent-foreground ring-offset-background hover:bg-accent hover:text-accent-foreground focus-visible:ring-ring ml-1 inline-flex h-9 w-9 items-center justify-center rounded-md bg-transparent p-0 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"

resources/js/components/app-sidebar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ import AppLogo from './app-logo';
1010
const mainNavItems: NavItem[] = [
1111
{
1212
title: 'Dashboard',
13-
url: '/dashboard',
13+
href: '/dashboard',
1414
icon: LayoutGrid,
1515
},
1616
];
1717

1818
const footerNavItems: NavItem[] = [
1919
{
2020
title: 'Repository',
21-
url: 'https://github.com/laravel/react-starter-kit',
21+
href: 'https://github.com/laravel/react-starter-kit',
2222
icon: Folder,
2323
},
2424
{
2525
title: 'Documentation',
26-
url: 'https://laravel.com/docs/starter-kits',
26+
href: 'https://laravel.com/docs/starter-kits',
2727
icon: BookOpen,
2828
},
2929
];

resources/js/components/nav-footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function NavFooter({
2020
asChild
2121
className="text-neutral-600 hover:text-neutral-800 dark:text-neutral-300 dark:hover:text-neutral-100"
2222
>
23-
<a href={item.url} target="_blank" rel="noopener noreferrer">
23+
<a href={item.href} target="_blank" rel="noopener noreferrer">
2424
{item.icon && <Icon iconNode={item.icon} className="h-5 w-5" />}
2525
<span>{item.title}</span>
2626
</a>

resources/js/components/nav-main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export function NavMain({ items = [] }: { items: NavItem[] }) {
1010
<SidebarMenu>
1111
{items.map((item) => (
1212
<SidebarMenuItem key={item.title}>
13-
<SidebarMenuButton asChild isActive={item.url === page.url}>
14-
<Link href={item.url} prefetch>
13+
<SidebarMenuButton asChild isActive={item.href === page.url}>
14+
<Link href={item.href} prefetch>
1515
{item.icon && <item.icon />}
1616
<span>{item.title}</span>
1717
</Link>

resources/js/layouts/settings/layout.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import { type PropsWithChildren } from 'react';
99
const sidebarNavItems: NavItem[] = [
1010
{
1111
title: 'Profile',
12-
url: '/settings/profile',
12+
href: '/settings/profile',
1313
icon: null,
1414
},
1515
{
1616
title: 'Password',
17-
url: '/settings/password',
17+
href: '/settings/password',
1818
icon: null,
1919
},
2020
{
2121
title: 'Appearance',
22-
url: '/settings/appearance',
22+
href: '/settings/appearance',
2323
icon: null,
2424
},
2525
];
@@ -41,15 +41,15 @@ export default function SettingsLayout({ children }: PropsWithChildren) {
4141
<nav className="flex flex-col space-y-1 space-x-0">
4242
{sidebarNavItems.map((item) => (
4343
<Button
44-
key={item.url}
44+
key={item.href}
4545
size="sm"
4646
variant="ghost"
4747
asChild
4848
className={cn('w-full justify-start', {
49-
'bg-muted': currentPath === item.url,
49+
'bg-muted': currentPath === item.href,
5050
})}
5151
>
52-
<Link href={item.url} prefetch>
52+
<Link href={item.href} prefetch>
5353
{item.title}
5454
</Link>
5555
</Button>

resources/js/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface NavGroup {
1717

1818
export interface NavItem {
1919
title: string;
20-
url: string;
20+
href: string;
2121
icon?: LucideIcon | null;
2222
isActive?: boolean;
2323
}

0 commit comments

Comments
 (0)