28 lines
642 B
TypeScript
28 lines
642 B
TypeScript
import {Money} from '@shopify/hydrogen';
|
|
import type {MoneyV2} from '@shopify/hydrogen/storefront-api-types';
|
|
|
|
export function ProductPrice({
|
|
price,
|
|
compareAtPrice,
|
|
}: {
|
|
price?: MoneyV2;
|
|
compareAtPrice?: MoneyV2 | null;
|
|
}) {
|
|
return (
|
|
<div aria-label="Price" className="product-price" role="group">
|
|
{compareAtPrice ? (
|
|
<div className="product-price-on-sale">
|
|
{price ? <Money data={price} /> : null}
|
|
<s>
|
|
<Money data={compareAtPrice} />
|
|
</s>
|
|
</div>
|
|
) : price ? (
|
|
<Money data={price} />
|
|
) : (
|
|
<span> </span>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|