forked from crowetic/commerce
Add missing links
This commit is contained in:
parent
fa625b5d06
commit
f37fbc00bf
@ -42,7 +42,9 @@ export default function Home({
|
|||||||
<div className="col-span-2">
|
<div className="col-span-2">
|
||||||
<ul className="mb-10">
|
<ul className="mb-10">
|
||||||
<li className="py-1 text-primary font-bold tracking-wide">
|
<li className="py-1 text-primary font-bold tracking-wide">
|
||||||
All Categories
|
<Link href={getCategoryPath('', brand)}>
|
||||||
|
<a>All Categories</a>
|
||||||
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{categories.map((cat) => (
|
{categories.map((cat) => (
|
||||||
<li
|
<li
|
||||||
@ -59,7 +61,9 @@ export default function Home({
|
|||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li className="py-1 text-primary font-bold tracking-wide">
|
<li className="py-1 text-primary font-bold tracking-wide">
|
||||||
All Designers
|
<Link href={getDesignerPath('', category)}>
|
||||||
|
<a>All Designers</a>
|
||||||
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{brands.flatMap(({ node }) => (
|
{brands.flatMap(({ node }) => (
|
||||||
<li
|
<li
|
||||||
@ -142,10 +146,13 @@ function useSearchMeta(asPath: string) {
|
|||||||
// Remove trailing and leading slash
|
// Remove trailing and leading slash
|
||||||
const getSlug = (path: string) => path.replace(/^\/|\/$/g, '')
|
const getSlug = (path: string) => path.replace(/^\/|\/$/g, '')
|
||||||
|
|
||||||
const getCategoryPath = (slug: string, designer?: string) =>
|
const getCategoryPath = (slug: string, brand?: string) =>
|
||||||
designer ? `/search/designers/${designer}/${slug}` : `/search/${slug}`
|
`/search${brand ? `/designers/${brand}` : ''}${slug ? `/${slug}` : ''}`
|
||||||
|
|
||||||
const getDesignerPath = (slug: string, category?: string) => {
|
const getDesignerPath = (slug: string, category?: string) => {
|
||||||
const designer = slug.replace(/^brands/, 'designers')
|
const designer = slug.replace(/^brands/, 'designers')
|
||||||
return `/search/${designer}${category ? `/${category}` : ''}`
|
|
||||||
|
return `/search${designer ? `/${designer}` : ''}${
|
||||||
|
category ? `/${category}` : ''
|
||||||
|
}`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user