mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
🔧 config: src folders structure
:%s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import '@assets/main.css'
|
||||
import '@assets/chrome-bug.css'
|
||||
import '../src/styles/main.css'
|
||||
import '../src/styles/chrome-bug.css'
|
||||
import 'keen-slider/keen-slider.min.css'
|
||||
|
||||
import { FC, useEffect } from 'react'
|
||||
|
@@ -1,53 +1,13 @@
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Layout } from '@components/common'
|
||||
import { ProductCard } from '@components/product'
|
||||
import { Grid, Marquee, Hero } from '@components/ui'
|
||||
// import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid'
|
||||
import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||
import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid'
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
locale,
|
||||
locales,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = { locale, locales }
|
||||
const productsPromise = commerce.getAllProducts({
|
||||
variables: { first: 6 },
|
||||
config,
|
||||
preview,
|
||||
// Saleor provider only
|
||||
...({ featured: true } as any),
|
||||
})
|
||||
const pagesPromise = commerce.getAllPages({ config, preview })
|
||||
const siteInfoPromise = commerce.getSiteInfo({ config, preview })
|
||||
const { products } = await productsPromise
|
||||
const { pages } = await pagesPromise
|
||||
const { categories, brands } = await siteInfoPromise
|
||||
|
||||
return {
|
||||
props: {
|
||||
products,
|
||||
categories,
|
||||
brands,
|
||||
pages,
|
||||
},
|
||||
revalidate: 60,
|
||||
}
|
||||
}
|
||||
|
||||
export default function Home({
|
||||
products,
|
||||
categories,
|
||||
brands,
|
||||
}: InferGetStaticPropsType<typeof getStaticProps>) {
|
||||
import { ButtonCommon, Layout } from 'src/components/common'
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<HomeAllProductsGrid
|
||||
products={products}
|
||||
categories={categories}
|
||||
brands={brands}
|
||||
/>
|
||||
<div>This is home page</div>
|
||||
<ButtonCommon />
|
||||
<p>Go to <code>pages/index.tsx</code> to get your hand dirty!</p>
|
||||
<p>Go to <code>src/components</code> to make your awesome component!</p>
|
||||
<p>Go to <code>src/styles</code> to find global styles!</p>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user