diff --git a/pages/search.tsx b/pages/search.tsx index 2b272e265..5740e275f 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -1,3 +1,4 @@ +import {useState} from 'react' import cn from 'classnames' import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next' import Link from 'next/link' @@ -43,6 +44,8 @@ export default function Search({ categories, brands, }: InferGetStaticPropsType) { + const [showMobileMenu, setShowMobileMenu] = useState(false) + const router = useRouter() const { asPath } = router const { q, sort } = router.query @@ -66,101 +69,155 @@ export default function Search({ sort: typeof sort === 'string' ? sort : '', }) + const Sort = () => ( + + ) + + const Categories = () => ( + + ) + + const Designers = () => ( + + ) + return (
-
- - +
+ +
-
+
{(q || activeCategory || activeBrand) && ( -
- {data ? ( - <> - - Showing {data.products.length} results{' '} - {q && ( - <> - for "{q}" - - )} - - - {q ? ( - <> - There are no products that match "{q}" - - ) : ( - <> - There are no products that match the selected category & - designer - - )} - - - ) : q ? ( - <> - Searching for: "{q}" - - ) : ( - <>Searching... +
+
+ {data ? ( + <> + + Showing {data.products.length} results{' '} + {q && ( + <> + for "{q}" + + )} + + + {q ? ( + <> + There are no products that match "{q}" + + ) : ( + <> + There are no products that match the selected category & + designer + + )} + + + ) : q ? ( +
+ Searching for: "{q}" +
+ ) : ( + <>Searching... + )} + + +
+ + {showMobileMenu && ( +
+
+ + +
+ +
)}
)} @@ -190,31 +247,8 @@ export default function Search({ )}
-
-
    -
  • Sort
  • -
  • - - Relevance - -
  • - {SORT.map(([key, text]) => ( -
  • - - {text} - -
  • - ))} -
+
+