diff --git a/pages/search.tsx b/pages/search.tsx index 4caa82da5..7d14f21d4 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -1,4 +1,4 @@ -import {useState} from 'react' +import { FC, useState } from 'react' import cn from 'classnames' import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next' import Link from 'next/link' @@ -21,6 +21,18 @@ import { useSearchMeta, } from '@lib/search' +interface OptionLinkProps { + active: boolean + name: string + pathname: string + query: string +} + +interface FilterOptionsProps { + pathname: string + title: string +} + export async function getStaticProps({ preview, locale, @@ -70,6 +82,43 @@ export default function Search({ sort: typeof sort === 'string' ? sort : '', }) + const OptionLink: FC = ({ + active, + name, + pathname, + query + }) => ( +
  • + + {name} + +
  • + ) + + const FilterOptions: FC = ({ + pathname, + title, + children, + }) => ( + + ) + const Sort = () => ( - ) - - const Categories = () => ( - - ) - - const Designers = () => ( - ) @@ -155,8 +147,38 @@ export default function Search({
    - - + + <> + {categories.map((cat) => ( + + ))} + + + + <> + {brands.flatMap(({ node }) => ( + + ))} + +
    {(q || activeCategory || activeBrand) && ( @@ -214,8 +236,38 @@ export default function Search({ {showMobileMenu && (
    - - + + <> + {categories.map((cat) => ( + + ))} + + + + <> + {brands.flatMap(({ node }) => ( + + ))} + +