2020-11-04 11:50:23 -03:00
|
|
|
|
import { Layout } from '@components/common'
|
2020-11-06 16:30:08 -03:00
|
|
|
|
import { Grid, Marquee, Hero } from '@components/ui'
|
2021-01-07 17:10:27 -03:00
|
|
|
|
import { ProductCard } from '@components/product'
|
2020-11-04 11:50:23 -03:00
|
|
|
|
import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid'
|
2020-11-06 16:30:08 -03:00
|
|
|
|
import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
2020-09-30 13:36:02 -05:00
|
|
|
|
|
2020-12-29 20:04:26 -05:00
|
|
|
|
import { getConfig } from '@framework/api'
|
2021-01-17 12:53:34 -03:00
|
|
|
|
import getAllProducts from '@framework/product/get-all-products'
|
|
|
|
|
import getSiteInfo from '@framework/common/get-site-info'
|
|
|
|
|
import getAllPages from '@framework/common/get-all-pages'
|
2020-10-29 12:10:53 -03:00
|
|
|
|
|
2020-10-24 16:10:31 -05:00
|
|
|
|
export async function getStaticProps({
|
|
|
|
|
preview,
|
|
|
|
|
locale,
|
|
|
|
|
}: GetStaticPropsContext) {
|
2020-10-25 15:14:54 -05:00
|
|
|
|
const config = getConfig({ locale })
|
2020-10-24 16:10:31 -05:00
|
|
|
|
|
2021-01-07 16:58:58 -03:00
|
|
|
|
const { products } = await getAllProducts({
|
2021-01-07 11:01:47 -03:00
|
|
|
|
variables: { first: 12 },
|
2020-10-25 15:14:54 -05:00
|
|
|
|
config,
|
2020-10-27 00:47:29 -05:00
|
|
|
|
preview,
|
2020-10-19 13:49:02 -05:00
|
|
|
|
})
|
2020-11-06 11:43:11 -03:00
|
|
|
|
|
2020-10-27 00:47:29 -05:00
|
|
|
|
const { categories, brands } = await getSiteInfo({ config, preview })
|
|
|
|
|
const { pages } = await getAllPages({ config, preview })
|
2020-10-05 11:44:14 -03:00
|
|
|
|
|
2020-11-06 11:43:11 -03:00
|
|
|
|
return {
|
|
|
|
|
props: {
|
2021-01-07 11:01:47 -03:00
|
|
|
|
products,
|
2020-11-06 11:43:11 -03:00
|
|
|
|
categories,
|
|
|
|
|
brands,
|
|
|
|
|
pages,
|
|
|
|
|
},
|
2021-02-12 09:56:03 +02:00
|
|
|
|
revalidate: 1440,
|
2020-11-06 11:43:11 -03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function Home({
|
2021-01-07 11:01:47 -03:00
|
|
|
|
products,
|
2020-11-06 11:43:11 -03:00
|
|
|
|
brands,
|
|
|
|
|
categories,
|
|
|
|
|
}: InferGetStaticPropsType<typeof getStaticProps>) {
|
2020-10-03 11:33:31 -03:00
|
|
|
|
return (
|
2021-01-10 15:55:11 -03:00
|
|
|
|
<>
|
2020-10-16 12:46:02 -03:00
|
|
|
|
<Grid>
|
2021-01-07 11:19:28 -03:00
|
|
|
|
{products.slice(0, 3).map((product, i) => (
|
2020-10-21 21:28:28 -05:00
|
|
|
|
<ProductCard
|
2021-01-07 11:19:28 -03:00
|
|
|
|
key={product.id}
|
|
|
|
|
product={product}
|
2021-01-06 21:24:09 -03:00
|
|
|
|
imgProps={{
|
|
|
|
|
width: i === 0 ? 1080 : 540,
|
|
|
|
|
height: i === 0 ? 1080 : 540,
|
|
|
|
|
}}
|
2020-10-21 21:28:28 -05:00
|
|
|
|
/>
|
2020-10-16 12:46:02 -03:00
|
|
|
|
))}
|
|
|
|
|
</Grid>
|
2021-01-07 11:58:00 -03:00
|
|
|
|
<Marquee variant="secondary">
|
|
|
|
|
{products.slice(0, 3).map((product, i) => (
|
2020-10-21 21:28:28 -05:00
|
|
|
|
<ProductCard
|
2021-01-07 11:58:00 -03:00
|
|
|
|
key={product.id}
|
|
|
|
|
product={product}
|
2020-10-21 21:28:28 -05:00
|
|
|
|
variant="slim"
|
2021-01-06 21:24:09 -03:00
|
|
|
|
imgProps={{
|
|
|
|
|
width: 320,
|
|
|
|
|
height: 320,
|
|
|
|
|
}}
|
2020-10-21 21:28:28 -05:00
|
|
|
|
/>
|
2020-10-16 12:46:02 -03:00
|
|
|
|
))}
|
|
|
|
|
</Marquee>
|
2020-10-04 17:47:05 -03:00
|
|
|
|
<Hero
|
|
|
|
|
headline="Release Details: The Yeezy BOOST 350 V2 ‘Natural'"
|
|
|
|
|
description="
|
|
|
|
|
The Yeezy BOOST 350 V2 lineup continues to grow. We recently had the
|
|
|
|
|
‘Carbon’ iteration, and now release details have been locked in for
|
|
|
|
|
this ‘Natural’ joint. Revealed by Yeezy Mafia earlier this year, the
|
|
|
|
|
shoe was originally called ‘Abez’, which translated to ‘Tin’ in
|
|
|
|
|
Hebrew. It’s now undergone a name change, and will be referred to as
|
|
|
|
|
‘Natural’."
|
|
|
|
|
/>
|
2020-10-16 12:46:02 -03:00
|
|
|
|
<Grid layout="B">
|
2021-01-07 11:58:00 -03:00
|
|
|
|
{products.slice(0, 3).map((product, i) => (
|
2020-10-21 21:28:28 -05:00
|
|
|
|
<ProductCard
|
2021-01-07 11:58:00 -03:00
|
|
|
|
key={product.id}
|
|
|
|
|
product={product}
|
2021-01-06 21:24:09 -03:00
|
|
|
|
imgProps={{
|
2021-01-07 11:58:00 -03:00
|
|
|
|
width: i === 0 ? 1080 : 540,
|
|
|
|
|
height: i === 0 ? 1080 : 540,
|
2021-01-06 21:24:09 -03:00
|
|
|
|
}}
|
2020-10-21 21:28:28 -05:00
|
|
|
|
/>
|
2020-10-16 12:46:02 -03:00
|
|
|
|
))}
|
|
|
|
|
</Grid>
|
|
|
|
|
<Marquee>
|
2021-01-07 11:58:00 -03:00
|
|
|
|
{products.slice(0, 3).map((product, i) => (
|
2020-10-21 21:28:28 -05:00
|
|
|
|
<ProductCard
|
2021-01-07 11:58:00 -03:00
|
|
|
|
key={product.id}
|
|
|
|
|
product={product}
|
2020-10-21 21:28:28 -05:00
|
|
|
|
variant="slim"
|
2021-01-06 21:24:09 -03:00
|
|
|
|
imgProps={{
|
|
|
|
|
width: 320,
|
|
|
|
|
height: 320,
|
|
|
|
|
}}
|
2020-10-21 21:28:28 -05:00
|
|
|
|
/>
|
2020-10-16 12:46:02 -03:00
|
|
|
|
))}
|
2021-01-07 11:58:00 -03:00
|
|
|
|
</Marquee>
|
2021-01-11 12:12:51 -03:00
|
|
|
|
{/* <HomeAllProductsGrid
|
2021-01-10 15:55:11 -03:00
|
|
|
|
newestProducts={products}
|
2020-10-26 20:02:29 -03:00
|
|
|
|
categories={categories}
|
|
|
|
|
brands={brands}
|
2021-01-11 12:12:51 -03:00
|
|
|
|
/> */}
|
2021-01-10 15:55:11 -03:00
|
|
|
|
</>
|
2020-10-03 11:33:31 -03:00
|
|
|
|
)
|
2020-09-30 11:44:38 -05:00
|
|
|
|
}
|
2020-10-01 21:30:08 -05:00
|
|
|
|
|
|
|
|
|
Home.Layout = Layout
|