4
0
forked from crowetic/commerce

Update SORT object to access from filter button on mobile (#194)

This commit is contained in:
Guillermo Angulo 2021-08-02 14:42:14 -03:00 committed by GitHub
parent e8b577b83f
commit 0603b342be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,12 +14,12 @@ import useSearch from '@framework/product/use-search'
import getSlug from '@lib/get-slug' import getSlug from '@lib/get-slug'
import rangeMap from '@lib/range-map' import rangeMap from '@lib/range-map'
const SORT = Object.entries({ const SORT = {
'trending-desc': 'Trending', 'trending-desc': 'Trending',
'latest-desc': 'Latest arrivals', 'latest-desc': 'Latest arrivals',
'price-asc': 'Price: Low to high', 'price-asc': 'Price: Low to high',
'price-desc': 'Price: High to low', 'price-desc': 'Price: High to low',
}) }
import { import {
filterQuery, filterQuery,
@ -351,7 +351,7 @@ export default function Search({ categories, brands }: SearchPropsType) {
aria-haspopup="true" aria-haspopup="true"
aria-expanded="true" aria-expanded="true"
> >
{sort ? `Sort: ${sort}` : 'Relevance'} {sort ? SORT[sort as keyof typeof SORT] : 'Relevance'}
<svg <svg
className="-mr-1 ml-2 h-5 w-5" className="-mr-1 ml-2 h-5 w-5"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -398,7 +398,7 @@ export default function Search({ categories, brands }: SearchPropsType) {
</a> </a>
</Link> </Link>
</li> </li>
{SORT.map(([key, text]) => ( {Object.entries(SORT).map(([key, text]) => (
<li <li
key={key} key={key}
className={cn( className={cn(