Skip to content

Instantly share code, notes, and snippets.

@Jerga99
Created July 9, 2021 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jerga99/5903bd040eaa7fd254a7426e185a5a68 to your computer and use it in GitHub Desktop.
Save Jerga99/5903bd040eaa7fd254a7426e185a5a68 to your computer and use it in GitHub Desktop.
import type { InferGetStaticPropsType } from "next"
import { getAllProducts } from "@framework/product"
import { getConfig } from "@framework/api/config"
import { Layout } from "@components/common"
import { ProductCard } from "@components/product"
import { Grid, Hero, Marquee } from "@components/ui"
export async function getStaticProps() {
const config = getConfig()
const products = await getAllProducts(config)
return {
props: {
products
},
revalidate: 4 * 60 * 60
}
}
export default function Home({
products
}: InferGetStaticPropsType<typeof getStaticProps>) {
return (
<>
<Grid>
{ products.slice(0,3).map(product =>
<ProductCard
key={product.id}
product={product}
/>
)}
</Grid>
<Hero
headline="Cookies, ice cream and muffin"
description="Marshmallow tart jelly icing cotton candy tootsie roll cotton candy candy canes. Cake liquorice sesame snaps. Cupcake cake cheesecake pie marshmallow lollipop soufflé marshmallow dessert. Cheesecake jujubes halvah chupa chups lollipop tootsie roll. Jelly-o tiramisu jelly toffee cake croissant lemon drops pudding. Donut sesame snaps gummi bears toffee. Sesame snaps jelly-o oat cake chocolate marzipan cake lollipop. Gingerbread cheesecake jujubes fruitcake cake. Tiramisu cotton candy marzipan candy canes oat cake pudding bonbon."
/>
<Marquee>
{ products.slice(0,3).map(product =>
<ProductCard
key={product.id}
variant="slim"
product={product}
/>
)}
</Marquee>
<Grid layout="B">
{ products.slice(0,3).map(product =>
<ProductCard
key={product.id}
product={product}
/>
)}
</Grid>
<Marquee variant="secondary">
{ products.slice(0,3).map(product =>
<ProductCard
key={product.id}
variant="slim"
product={product}
/>
)}
</Marquee>
</>
)
}
Home.Layout = Layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment