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

61 lines
2.0 KiB
TypeScript
Raw Normal View History

import type { GetStaticPropsContext } from 'next'
2020-12-29 20:04:26 -05:00
import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import useWishlist from '@framework/wishlist/use-wishlist'
2020-11-04 11:50:23 -03:00
import { Layout } from '@components/common'
import { Heart } from '@components/icons'
2020-11-26 15:03:21 -03:00
import { Text, Container } from '@components/ui'
2020-10-13 14:15:20 -03:00
import { WishlistCard } from '@components/wishlist'
2021-01-11 12:15:26 -03:00
<<<<<<< HEAD
2020-11-26 13:13:30 -03:00
import { defatultPageProps } from '@lib/defaults'
2021-01-10 14:11:00 -03:00
import { useCustomer } from '@framework/customer'
2021-01-11 12:15:26 -03:00
=======
import { defaultPageProps } from '@lib/defaults'
2021-01-11 12:15:26 -03:00
>>>>>>> master
2020-10-13 14:15:20 -03:00
2020-10-27 04:00:42 -05:00
export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const { pages } = await getAllPages({ config, preview })
2020-10-13 10:03:53 -03:00
return {
props: { ...defaultPageProps, pages },
2020-10-13 10:03:53 -03:00
}
}
export default function Wishlist() {
2021-01-10 14:11:00 -03:00
const { data: customer } = useCustomer()
const { data, isEmpty } = useWishlist()
2020-10-13 10:03:53 -03:00
return (
2020-11-26 15:03:21 -03:00
<Container>
<div className="mt-3 mb-20">
<Text variant="pageHeading">My Wishlist</Text>
<div className="group flex flex-col">
{isEmpty ? (
<div className="flex-1 px-12 py-24 flex flex-col justify-center items-center ">
<span className="border border-dashed border-secondary flex items-center justify-center w-16 h-16 bg-primary p-12 rounded-lg text-primary">
<Heart className="absolute" />
</span>
<h2 className="pt-6 text-2xl font-bold tracking-wide text-center">
Your wishlist is empty
</h2>
<p className="text-accents-6 px-10 text-center pt-2">
Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.
</p>
</div>
) : (
data &&
data.items?.map((item) => (
<WishlistCard key={item.id} item={item} />
))
)}
</div>
2020-10-13 11:43:06 -03:00
</div>
2020-11-26 15:03:21 -03:00
</Container>
2020-10-13 10:03:53 -03:00
)
}
Wishlist.Layout = Layout