import { GetStaticPropsContext, InferGetStaticPropsType } from 'next' import getAllProducts from '@lib/bigcommerce/api/operations/get-all-products' import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info' import useSearch from '@lib/bigcommerce/products/use-search' import { Layout } from '@components/core' import { Grid } from '@components/ui' import { ProductCard } from '@components/product' import { useRouter } from 'next/router' export async function getStaticProps({ preview }: GetStaticPropsContext) { const { products } = await getAllProducts() const { categories, brands } = await getSiteInfo() return { props: { products, categories, brands }, } } export default function Home({ products, categories, brands, }: InferGetStaticPropsType) { const router = useRouter() const search = useSearch({ search: router.query.search as string }) console.log('SEARCH', search) return (
  • All Categories
  • {categories.map((cat) => (
  • {cat.name}
  • ))}
  • All Designers
  • {brands.flatMap(({ node }) => (
  • {node.name}
  • ))}
Showing 8 results for "{router.query.q}"
  • Relevance
  • Latest arrivals
  • Trending
  • Price: Low to high
  • Price: High to low
) } Home.Layout = Layout