From 06902acc47100e14c8aaabeff990297ee9962805 Mon Sep 17 00:00:00 2001 From: georgekaran Date: Tue, 3 Nov 2020 15:00:31 -0300 Subject: [PATCH] fix: ensure search layout dont break on mobile --- pages/search.tsx | 81 +++++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/pages/search.tsx b/pages/search.tsx index bb892bdaf..1696d542f 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -39,6 +39,41 @@ const SORT = Object.entries({ 'price-desc': 'Price: High to low', }) +type SortItemsProps = { + q: string | string[] | undefined + sort: string | string[] | undefined + pathname: string +} + +const SortItems = ({ pathname, sort, q }:SortItemsProps) => { + return ( + <> +
  • Sort
  • +
  • + + Relevance + +
  • + {SORT.map(([key, text]) => ( +
  • + + {text} + +
  • + ))} + + ) +} + export default function Search({ categories, brands, @@ -69,9 +104,16 @@ export default function Search({ return (
    -
    +
    +
      + +
      -
    • +
    • All Categories @@ -79,7 +121,7 @@ export default function Search({ {categories.map((cat) => (
    • @@ -95,7 +137,7 @@ export default function Search({ ))}
      -
    • +
    • All Designers @@ -103,7 +145,7 @@ export default function Search({ {brands.flatMap(({ node }) => (
    • @@ -190,30 +232,13 @@ export default function Search({ )}
    -
    +
      -
    • Sort
    • -
    • - - Relevance - -
    • - {SORT.map(([key, text]) => ( -
    • - - {text} - -
    • - ))} +