Skip to content

Commit 4d8bda7

Browse files
authored
Merge pull request #1324 from almadhoob/routing/hotfix
Improve the dynamic links of categories
2 parents 284b273 + c7375f3 commit 4d8bda7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/components/Category/Categories.component.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ const Categories = ({ categories }: ICategoriesProps) => (
1111
{categories.map(({ id, name, slug }) => (
1212
<Link
1313
key={uuidv4()}
14-
as={`/kategori/${slug}?id=${id}`}
15-
href="/kategori/[id]"
16-
passHref
14+
href={`/kategori/${encodeURIComponent(slug)}?id=${encodeURIComponent(id)}`}
1715
>
1816
<div className="p-6 cursor-pointer">
1917
<div className="flex items-center justify-center w-full h-16 text-center border border-gray-300 rounded-lg shadow hover:shadow-outline">

src/components/Product/DisplayProducts.component.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ interface IDisplayProductsProps {
4848

4949
const DisplayProducts = ({ products }: IDisplayProductsProps) => (
5050
<section className="container mx-auto bg-white">
51-
<div id="product-container" className="flex flex-wrap items-center mb-[120px] md:mb-0">
51+
<div
52+
id="product-container"
53+
className="flex flex-wrap items-center mb-[120px] md:mb-0"
54+
>
5255
{products ? (
5356
products.map(
5457
({
@@ -103,7 +106,6 @@ const DisplayProducts = ({ products }: IDisplayProductsProps) => (
103106
)}
104107
</span>
105108
</Link>
106-
107109
<Link
108110
href={`/produkt/${encodeURIComponent(
109111
slug,
@@ -132,7 +134,9 @@ const DisplayProducts = ({ products }: IDisplayProductsProps) => (
132134
)}
133135
{/* Display regular price when not on sale */}
134136
{!onSale && (
135-
<p className="pt-1 text-center text-gray-900 text-xl">{price}</p>
137+
<p className="pt-1 text-center text-gray-900 text-xl">
138+
{price}
139+
</p>
136140
)}
137141
</div>
138142
);

0 commit comments

Comments
 (0)