Added brands

This commit is contained in:
Luis Alvarez
2020-10-10 14:19:05 -05:00
parent 8e42fdd25d
commit 4c43278e67
7 changed files with 101 additions and 11 deletions

View File

@@ -7,16 +7,17 @@ import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
export async function getStaticProps({ preview }: GetStaticPropsContext) {
const { products } = await getAllProducts()
const { categories } = await getSiteInfo()
const { categories, brands } = await getSiteInfo()
return {
props: { products, categories },
props: { products, categories, brands },
}
}
export default function Home({
products,
categories,
brands,
}: InferGetStaticPropsType<typeof getStaticProps>) {
return (
<>
@@ -53,6 +54,16 @@ export default function Home({
</li>
))}
</ul>
<ul className="uppercase mt-6">
<li>
<h2 className="font-bold">All Designers</h2>
</li>
{brands.flatMap(({ node }) => (
<li key={node.path} className="mt-2">
<a href="#">{node.name}</a>
</li>
))}
</ul>
</div>
<div className="flex-1">
<Grid

View File

@@ -42,7 +42,7 @@ export async function getStaticPaths() {
const { products } = await getAllProductPaths()
return {
paths: products.map((product) => `/product${product!.node.path}`),
paths: products.map((product) => `/product${product.node.path}`),
fallback: false,
}
}