4
0
forked from crowetic/commerce
commerce/pages/wishlist.tsx

64 lines
2.1 KiB
TypeScript
Raw Normal View History

2020-10-27 00:47:29 -05:00
import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
2020-10-15 18:55:39 -05:00
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
2020-10-27 00:47:29 -05:00
import useWishlist from '@lib/bigcommerce/wishlist/use-wishlist'
2020-10-13 10:03:53 -03:00
import { Layout } from '@components/core'
2020-10-24 17:55:30 -03:00
import { Container, Text } from '@components/ui'
2020-10-13 14:15:20 -03:00
import { WishlistCard } from '@components/wishlist'
2020-10-13 10:03:53 -03:00
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
export async function getStaticProps({ preview }: GetStaticPropsContext) {
2020-10-27 00:47:29 -05:00
const { pages } = await getAllPages({ preview })
const { categories, brands } = await getSiteInfo({ preview })
2020-10-13 10:03:53 -03:00
return {
2020-10-15 18:55:39 -05:00
props: { pages, categories, brands },
2020-10-13 10:03:53 -03:00
}
}
2020-10-13 11:43:06 -03:00
export default function Home({
categories,
brands,
}: InferGetStaticPropsType<typeof getStaticProps>) {
2020-10-27 00:47:29 -05:00
const { data } = useWishlist()
2020-10-13 10:03:53 -03:00
return (
<Container>
2020-10-13 11:43:06 -03:00
<div className="grid grid-cols-12 gap-8 mt-3 mb-20">
<div className="col-span-2">
<ul className="mb-10">
2020-10-15 16:00:11 -03:00
<li className="py-1 text-base font-bold tracking-wide">
2020-10-13 11:43:06 -03:00
All Categories
</li>
{categories.map((cat) => (
<li key={cat.path} className="py-1 text-secondary">
<a href="#">{cat.name}</a>
</li>
))}
</ul>
</div>
2020-10-13 14:15:20 -03:00
<div className="col-span-8">
2020-10-24 17:55:30 -03:00
<Text variant="pageHeading">My Wishlist</Text>
2020-10-13 14:15:20 -03:00
<div className="group flex flex-col">
{[1, 2, 3, 4, 5, 6].map((i) => (
2020-10-24 16:57:10 -03:00
<WishlistCard key={i} />
2020-10-13 14:15:20 -03:00
))}
</div>
</div>
2020-10-13 11:43:06 -03:00
<div className="col-span-2">
<ul>
2020-10-15 16:00:11 -03:00
<li className="py-1 text-base font-bold tracking-wide">
2020-10-13 11:43:06 -03:00
Relevance
</li>
<li className="py-1 text-secondary">Latest arrivals</li>
<li className="py-1 text-secondary">Trending</li>
<li className="py-1 text-secondary">Price: Low to high</li>
<li className="py-1 text-secondary">Price: High to low</li>
</ul>
</div>
</div>
2020-10-13 10:03:53 -03:00
</Container>
)
}
Home.Layout = Layout