Add links to the categories & brands in the landing
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import getSlug from './get-slug'
|
||||
|
||||
export function useSearchMeta(asPath: string) {
|
||||
const [pathname, setPathname] = useState<string>('/search')
|
||||
@@ -34,11 +35,16 @@ export const filterQuery = (query: any) =>
|
||||
return obj
|
||||
}, {})
|
||||
|
||||
export const getCategoryPath = (slug: string, brand?: string) =>
|
||||
`/search${brand ? `/designers/${brand}` : ''}${slug ? `/${slug}` : ''}`
|
||||
export const getCategoryPath = (path: string, brand?: string) => {
|
||||
const category = getSlug(path)
|
||||
|
||||
export const getDesignerPath = (slug: string, category?: string) => {
|
||||
const designer = slug.replace(/^brands/, 'designers')
|
||||
return `/search${brand ? `/designers/${brand}` : ''}${
|
||||
category ? `/${category}` : ''
|
||||
}`
|
||||
}
|
||||
|
||||
export const getDesignerPath = (path: string, category?: string) => {
|
||||
const designer = getSlug(path).replace(/^brands/, 'designers')
|
||||
|
||||
return `/search${designer ? `/${designer}` : ''}${
|
||||
category ? `/${category}` : ''
|
||||
|
||||
Reference in New Issue
Block a user