import React from 'react'; import type { ZoraBaseProps } from '../../../../types/base'; import type { ProductCardProps } from '../../../../types/product-card'; import { Badge } from '../../../badge/public'; import { Button } from '../../../button/public'; import { Image } from '../../../image/public'; import { Divider, View } from '../../../layout/public'; import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope'; import { Heading } from '../../../typography/public'; import { Text } from '../../../typography/public'; import { Card } from '../../public'; export const ProductCard = withZoraThemeScope(ProductCardInner); function ProductCardInner({ title, subtitle, description, brand, vendor: _vendor, imageUrl, imageAlt, price, currency, badges, meta, primaryActionLabel, secondaryActionLabel, onPress, onPrimaryAction, onSecondaryAction, interactionPolicy, ...rest }: ProductCardProps & ZoraBaseProps) { const hasHeaderInfo = !!title || !!brand || !!subtitle; const hasMeta = !!meta && meta.length > 0; const hasActions = !!primaryActionLabel || !!secondaryActionLabel; const isInteractive = Boolean(onPress); const eyebrow = brand ?? _vendor; return ( {imageUrl ? ( ) : null} {hasHeaderInfo ? ( {eyebrow ? ( {eyebrow} ) : null} {title} {subtitle ? ( {subtitle} ) : null} ) : null} {description ? {description} : null} {badges && badges.length > 0 ? ( {badges.map((badge, index) => ( {badge} ))} ) : null} {price ? ( {currency ? `${currency} ` : ''} {price} ) : null} {hasMeta ? ( {meta.map((item, index) => ( {item.label} {item.value} ))} ) : null} {hasActions ? ( {secondaryActionLabel ? ( ) : null} {primaryActionLabel ? ( ) : null} ) : null} ); }