Skip to content

Commit 2b1863c

Browse files
committed
fix: legacyBehavior on Link
1 parent 8866332 commit 2b1863c

File tree

16 files changed

+86
-64
lines changed

16 files changed

+86
-64
lines changed

src/modules/account/components/account-nav/index.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const AccountNav = () => {
1212
<div>
1313
<div className="small:hidden">
1414
{route !== "/account" && (
15-
<Link href="/account" className="flex items-center gap-x-2 text-small-regular py-2">
15+
<Link
16+
href="/account"
17+
className="flex items-center gap-x-2 text-small-regular py-2"
18+
legacyBehavior>
1619
<ChevronDown className="transform rotate-90" />
1720
<span>Account</span>
1821
</Link>
@@ -55,7 +58,7 @@ const AccountNav = () => {
5558
</div>
5659
</div>
5760
</div>
58-
)
61+
);
5962
}
6063

6164
type AccountNavLinkProps = {
@@ -67,12 +70,15 @@ type AccountNavLinkProps = {
6770
const AccountNavLink = ({ href, route, children }: AccountNavLinkProps) => {
6871
const active = route === href
6972
return (
70-
<Link href={href} className={clsx("text-gray-700", {
71-
"text-gray-900 font-semibold": active,
72-
})}>
73+
<Link
74+
href={href}
75+
className={clsx("text-gray-700", {
76+
"text-gray-900 font-semibold": active,
77+
})}
78+
legacyBehavior>
7379
{children}
7480
</Link>
75-
)
81+
);
7682
}
7783

7884
export default AccountNav

src/modules/account/components/order-card/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ const OrderCard = ({ order }: OrderCardProps) => {
6565
)}
6666
</div>
6767
<div className="flex justify-end">
68-
<Link href={`/order/details/${order.id}`}>
68+
<Link href={`/order/details/${order.id}`} legacyBehavior>
6969
<Button variant="secondary">See details</Button>
7070
</Link>
7171
</div>
7272
</div>
73-
)
73+
);
7474
}
7575

7676
export default OrderCard

src/modules/account/components/order-overview/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ const OrderOverview = () => {
3737
You don&apos;t have any orders yet, let us change that {":)"}
3838
</p>
3939
<div className="mt-4">
40-
<Link href="/" passHref>
40+
<Link href="/" passHref legacyBehavior>
4141
<Button>Continue shopping</Button>
4242
</Link>
4343
</div>
4444
</div>
45-
)
45+
);
4646
}
4747

4848
export default OrderOverview

src/modules/account/components/overview/index.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ const Overview = ({ orders, customer }: OverviewProps) => {
2121
<div className="text-base-regular">
2222
<ul>
2323
<li>
24-
<Link href="/account/profile"
25-
className="flex items-center justify-between py-4 border-b border-gray-200 px-8">
24+
<Link
25+
href="/account/profile"
26+
className="flex items-center justify-between py-4 border-b border-gray-200 px-8"
27+
legacyBehavior>
2628
<div className="flex items-center gap-x-2">
2729
<User size={16} />
2830
<span>Profile</span>
@@ -31,8 +33,10 @@ const Overview = ({ orders, customer }: OverviewProps) => {
3133
</Link>
3234
</li>
3335
<li>
34-
<Link href="/account/addresses"
35-
className="flex items-center justify-between py-4 border-b border-gray-200 px-8">
36+
<Link
37+
href="/account/addresses"
38+
className="flex items-center justify-between py-4 border-b border-gray-200 px-8"
39+
legacyBehavior>
3640
<div className="flex items-center gap-x-2">
3741
<MapPin size={16} />
3842
<span>Addresses</span>
@@ -41,8 +45,10 @@ const Overview = ({ orders, customer }: OverviewProps) => {
4145
</Link>
4246
</li>
4347
<li>
44-
<Link href="/account/orders"
45-
className="flex items-center justify-between py-4 border-b border-gray-200 px-8">
48+
<Link
49+
href="/account/orders"
50+
className="flex items-center justify-between py-4 border-b border-gray-200 px-8"
51+
legacyBehavior>
4652
<div className="flex items-center gap-x-2">
4753
<Package size={16} />
4854
<span>Orders</span>
@@ -99,7 +105,7 @@ const Overview = ({ orders, customer }: OverviewProps) => {
99105
orders.slice(0, 5).map((order) => {
100106
return (
101107
<li key={order.id}>
102-
<Link href={`/order/details/${order.id}`}>
108+
<Link href={`/order/details/${order.id}`} legacyBehavior>
103109
<div className="bg-gray-50 flex justify-between items-center p-4">
104110
<div className="grid grid-cols-3 grid-rows-2 text-small-regular gap-x-4 flex-1">
105111
<span className="font-semibold">
@@ -135,7 +141,7 @@ const Overview = ({ orders, customer }: OverviewProps) => {
135141
</div>
136142
</Link>
137143
</li>
138-
)
144+
);
139145
})
140146
) : (
141147
<span>No recent orders</span>
@@ -146,7 +152,7 @@ const Overview = ({ orders, customer }: OverviewProps) => {
146152
</div>
147153
</div>
148154
</div>
149-
)
155+
);
150156
}
151157

152158
const getProfileCompletion = (customer?: Omit<Customer, "password_hash">) => {

src/modules/cart/components/sign-in-prompt/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const SignInPrompt = () => {
1111
</p>
1212
</div>
1313
<div>
14-
<Link href="/account/login">
14+
<Link href="/account/login" legacyBehavior>
1515
<Button variant="secondary">Sign in</Button>
1616
</Link>
1717
</div>
1818
</div>
19-
)
19+
);
2020
}
2121

2222
export default SignInPrompt

src/modules/cart/templates/summary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ const Summary = ({ cart }: SummaryProps) => {
1111
return (
1212
<div className="grid grid-cols-1 gap-y-6">
1313
<CartTotals cart={cart} />
14-
<Link href="/checkout">
14+
<Link href="/checkout" legacyBehavior>
1515
<Button>Go to checkout</Button>
1616
</Link>
1717
</div>
18-
)
18+
);
1919
}
2020

2121
export default Summary

src/modules/checkout/templates/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ const CheckoutTemplate = () => {
1212
<div className="bg-gray-100 relative small:min-h-screen">
1313
<div className="h-16 bg-white">
1414
<nav className="flex items-center h-full justify-between content-container">
15-
<Link href="/cart"
16-
className="text-small-semi text-gray-700 flex items-center gap-x-2 uppercase flex-1 basis-0">
15+
<Link
16+
href="/cart"
17+
className="text-small-semi text-gray-700 flex items-center gap-x-2 uppercase flex-1 basis-0"
18+
legacyBehavior>
1719
<ChevronDown className="rotate-90" size={16} />
1820
<span className="mt-px hidden small:block">
1921
Back to shopping cart
@@ -38,7 +40,7 @@ const CheckoutTemplate = () => {
3840
</div>
3941
</div>
4042
</CheckoutProvider>
41-
)
43+
);
4244
}
4345

4446
export default CheckoutTemplate

src/modules/common/components/underline-link/index.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ type UnderlineLinkProps = {
99
const UnderlineLink = ({ href, children }: UnderlineLinkProps) => {
1010
return (
1111
<div className="flex items-start">
12-
<Link href={href}
13-
className="flex items-center text-large-regular border-b border-current gap-x-4 py-2 transition-all duration-300 group hover:pl-4 hover:pr-1">
14-
<span>{children}</span>
15-
<ArrowRight
16-
size={20}
17-
className="transition-all group-hover:ml-2 duration-300"
18-
/>
12+
<Link
13+
href={href}
14+
className="flex items-center text-large-regular border-b border-current gap-x-4 py-2 transition-all duration-300 group hover:pl-4 hover:pr-1"
15+
legacyBehavior>
16+
<>
17+
<span>{children}</span>
18+
<ArrowRight
19+
size={20}
20+
className="transition-all group-hover:ml-2 duration-300"
21+
/>
22+
</>
1923
</Link>
2024
</div>
2125
)

src/modules/layout/components/cart-dropdown/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const CartDropdown = () => {
2020
return (
2121
<div className="h-full z-50" onMouseEnter={open} onMouseLeave={close}>
2222
<Popover className="relative h-full">
23-
<Link href="/cart" passHref>
23+
<Link href="/cart" passHref legacyBehavior>
2424
<Popover.Button className="h-full">{`My Bag (${totalItems})`}</Popover.Button>
2525
</Link>
2626
<Transition
@@ -61,9 +61,7 @@ const CartDropdown = () => {
6161
<div>
6262
<h3
6363
className="text-base-regular overflow-ellipsis overflow-hidden whitespace-nowrap mr-4 w-[130px]">
64-
<Link
65-
href={`/products/${item.variant.product.handle}`}
66-
>
64+
<Link href={`/products/${item.variant.product.handle}`} legacyBehavior>
6765
{item.title}
6866
</Link>
6967
</h3>
@@ -108,7 +106,7 @@ const CartDropdown = () => {
108106
})}
109107
</span>
110108
</div>
111-
<Link href="/cart" passHref>
109+
<Link href="/cart" passHref legacyBehavior>
112110
<Button>Go to bag</Button>
113111
</Link>
114112
</div>
@@ -122,9 +120,11 @@ const CartDropdown = () => {
122120
</div>
123121
<span>Your shopping bag is empty.</span>
124122
<div>
125-
<Link href="/store">
126-
<span className="sr-only">Go to all products page</span>
127-
<Button onClick={close}>Explore products</Button>
123+
<Link href="/store" legacyBehavior>
124+
<>
125+
<span className="sr-only">Go to all products page</span>
126+
<Button onClick={close}>Explore products</Button>
127+
</>
128128
</Link>
129129
</div>
130130
</div>

src/modules/layout/components/dropdown-menu/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const DropdownMenu = () => {
2929
<div className="flex items-center h-full">
3030
<Popover className="h-full flex">
3131
<>
32-
<Link href="/shop" className="relative flex h-full" passHref>
32+
<Link href="/shop" className="relative flex h-full" passHref legacyBehavior>
3333
<Popover.Button
3434
className={clsx(
3535
"relative h-full flex items-center transition-all ease-out duration-200",
@@ -74,14 +74,14 @@ const DropdownMenu = () => {
7474
<Link
7575
href={`/collections/${collection.id}`}
7676
onClick={() => setOpen(false)}
77-
>
77+
legacyBehavior>
7878
{collection.title}
7979
</Link>
8080
</div>
81-
)
81+
);
8282
})}
8383
</ul>
84-
)
84+
);
8585
})}
8686
{loadingCollections &&
8787
repeat(6).map((index) => (
@@ -111,7 +111,7 @@ const DropdownMenu = () => {
111111
</Popover>
112112
</div>
113113
</div>
114-
)
114+
);
115115
}
116116

117117
export default DropdownMenu

0 commit comments

Comments
 (0)