import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import useCart from '@framework/cart/use-cart'
import usePrice from '@framework/product/use-price'
import { Layout } from '@components/common'
import { Button } from '@components/ui'
import { Bag, Cross, Check } from '@components/icons'
import { CartItem } from '@components/cart'
import { Text } from '@components/ui'
export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const { pages } = await getAllPages({ config, preview })
return {
props: { pages },
}
}
export default function Cart() {
const { data, isEmpty } = useCart()
const loading = !data
if (loading) {
// Load skeleton
return
Loading
}
console.log('Cart Data', data)
// const { price: subTotal } = usePrice(
// data && {
// amount: data.base_amount,
// currencyCode: data.currency.code,
// }
// )
// const { price: total } = usePrice(
// data && {
// amount: data.cart_amount,
// currencyCode: data.currency.code,
// }
// )
// const items = data?.line_items.physical_items ?? []
// const error = null
// const success = null
return hola
return (
{isEmpty ? (
Your cart is empty
Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.
) : error ? (
We couldn’t process the purchase. Please check your card
information and try again.
) : success ? (
Thank you for your order.
) : (
My Cart
Review your Order
{items.map((item) => (
))}
Before you leave, take a look at these items. We picked them
just for you
{[1, 2, 3, 4, 5, 6].map((x) => (
))}
)}
-
Subtotal
{subTotal}
-
Taxes
Calculated at checkout
-
Estimated Shipping
FREE
Total
{total}
{isEmpty ? (
) : (
)}
)
}
Cart.Layout = Layout