Skip to content

Commit 67e8ae7

Browse files
committed
fix: conditional rendering
1 parent ec86789 commit 67e8ae7

File tree

1 file changed

+32
-28
lines changed
  • src/modules/layout/components/footer-nav

1 file changed

+32
-28
lines changed

src/modules/layout/components/footer-nav/index.tsx

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,40 @@ const FooterNav = () => {
1818
</Link>
1919
</div>
2020
<div className="text-small-regular grid grid-cols-3 gap-x-16">
21-
<div className="flex flex-col gap-y-2">
22-
<span className="text-base-semi">Categories</span>
23-
<ul
24-
className={clsx("grid grid-cols-1 gap-2", {
25-
"grid-cols-2": (product_categories?.length || 0) > 3,
26-
})}
27-
>
28-
{product_categories?.slice(0, 6).map((c) => {
29-
return (
21+
{product_categories && (
22+
<div className="flex flex-col gap-y-2">
23+
<span className="text-base-semi">Categories</span>
24+
<ul
25+
className={clsx("grid grid-cols-1 gap-2", {
26+
"grid-cols-2": (product_categories?.length || 0) > 3,
27+
})}
28+
>
29+
{product_categories?.slice(0, 6).map((c) => {
30+
return (
31+
<li key={c.id}>
32+
<Link href={`/categories/${c.handle}`}>{c.name}</Link>
33+
</li>
34+
)
35+
})}
36+
</ul>
37+
</div>
38+
)}
39+
{collections && (
40+
<div className="flex flex-col gap-y-2">
41+
<span className="text-base-semi">Collections</span>
42+
<ul
43+
className={clsx("grid grid-cols-1 gap-2", {
44+
"grid-cols-2": (collections?.length || 0) > 3,
45+
})}
46+
>
47+
{collections?.slice(0, 6).map((c) => (
3048
<li key={c.id}>
31-
<Link href={`/categories/${c.handle}`}>{c.name}</Link>
49+
<Link href={`/collections/${c.handle}`}>{c.title}</Link>
3250
</li>
33-
)
34-
})}
35-
</ul>
36-
</div>
37-
<div className="flex flex-col gap-y-2">
38-
<span className="text-base-semi">Collections</span>
39-
<ul
40-
className={clsx("grid grid-cols-1 gap-2", {
41-
"grid-cols-2": (collections?.length || 0) > 3,
42-
})}
43-
>
44-
{collections?.slice(0, 6).map((c) => (
45-
<li key={c.id}>
46-
<Link href={`/collections/${c.handle}`}>{c.title}</Link>
47-
</li>
48-
))}
49-
</ul>
50-
</div>
51+
))}
52+
</ul>
53+
</div>
54+
)}
5155
<div className="flex flex-col gap-y-2">
5256
<span className="text-base-semi">Medusa</span>
5357
<ul className="grid grid-cols-1 gap-y-2">

0 commit comments

Comments
 (0)