mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
More updates
This commit is contained in:
@@ -8,6 +8,7 @@ import { Button } from '@components/ui'
|
||||
import { Bag, Cross, Check } from '@components/icons'
|
||||
import { CartItem } from '@components/cart'
|
||||
import { Text } from '@components/ui'
|
||||
import products from '@framework/api/catalog/products'
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
@@ -21,34 +22,23 @@ export async function getStaticProps({
|
||||
}
|
||||
|
||||
export default function Cart() {
|
||||
const error = null
|
||||
const success = null
|
||||
const { data, isEmpty } = useCart()
|
||||
const loading = !data
|
||||
|
||||
if (loading) {
|
||||
// Load skeleton
|
||||
return <div>Loading</div>
|
||||
}
|
||||
|
||||
const { price: subTotal } = usePrice(
|
||||
data && {
|
||||
amount: data.base_amount,
|
||||
currencyCode: data.currency.code,
|
||||
amount: Number(data.subTotal),
|
||||
currencyCode: data.currency.code || 'USD',
|
||||
}
|
||||
)
|
||||
const { price: total } = usePrice(
|
||||
data && {
|
||||
amount: data.cart_amount,
|
||||
currencyCode: data.currency.code,
|
||||
amount: Number(data.total),
|
||||
currencyCode: data.currency?.code || 'USD',
|
||||
}
|
||||
)
|
||||
|
||||
// const items = data?.line_items.physical_items ?? []
|
||||
|
||||
// const error = null
|
||||
// const success = null
|
||||
|
||||
return <div>hola</div>
|
||||
|
||||
return (
|
||||
<div className="grid lg:grid-cols-12">
|
||||
<div className="lg:col-span-8">
|
||||
@@ -88,7 +78,7 @@ export default function Cart() {
|
||||
<Text variant="pageHeading">My Cart</Text>
|
||||
<Text variant="sectionHeading">Review your Order</Text>
|
||||
<ul className="py-6 space-y-6 sm:py-0 sm:space-y-0 sm:divide-y sm:divide-accents-2 border-b border-accents-2">
|
||||
{items.map((item) => (
|
||||
{data?.items.map((item) => (
|
||||
<CartItem
|
||||
key={item.id}
|
||||
item={item}
|
||||
|
@@ -110,9 +110,9 @@ export default function Search({
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
fillRule="evenodd"
|
||||
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
||||
clip-rule="evenodd"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
@@ -209,9 +209,9 @@ export default function Search({
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
fillRule="evenodd"
|
||||
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
||||
clip-rule="evenodd"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
@@ -384,9 +384,9 @@ export default function Search({
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
fillRule="evenodd"
|
||||
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
||||
clip-rule="evenodd"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
|
Reference in New Issue
Block a user