forked from crowetic/commerce
Check for nullables in product info
This commit is contained in:
parent
6e8a6be6ba
commit
d94396baac
@ -8,17 +8,10 @@ import type { Product } from '@lib/bigcommerce/api/operations/get-product'
|
||||
import useAddItem from '@lib/bigcommerce/cart/use-add-item'
|
||||
import { useUI } from '@components/ui/context'
|
||||
|
||||
interface ProductData {
|
||||
name: string
|
||||
images?: any
|
||||
prices?: any
|
||||
path: string
|
||||
}
|
||||
|
||||
interface Props {
|
||||
className?: string
|
||||
children?: any
|
||||
product: Product & ProductData
|
||||
product: Product
|
||||
}
|
||||
|
||||
interface Choices {
|
||||
@ -56,16 +49,16 @@ const ProductView: FC<Props> = ({ product, className }) => {
|
||||
{product.name}
|
||||
</h1>
|
||||
<div className="px-6 py-2 pb-4 bg-violet text-white font-semibold inline-block">
|
||||
{product.prices.price.value}
|
||||
{product.prices?.price.value}
|
||||
{` `}
|
||||
{product.prices.price.currencyCode}
|
||||
{product.prices?.price.currencyCode}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1 h-48 p-24 relative min-h-screen overflow-hidden">
|
||||
<div className="absolute z-10 inset-0 flex items-center justify-center">
|
||||
<img
|
||||
className="w-full object-cover"
|
||||
src={product.images.edges[0].node.urlSmall}
|
||||
src={product.images.edges?.[0]?.node.urlSmall}
|
||||
/>
|
||||
</div>
|
||||
<div className=" absolute inset-24 z-0 bg-violet"></div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user