import React from 'react'; import Box from '@mui/material/Box'; import Tooltip from '@mui/material/Tooltip'; import StarRoundedIcon from '@mui/icons-material/StarRounded'; import VerifiedOutlinedIcon from '@mui/icons-material/VerifiedOutlined'; import type { SxProps, Theme } from '@mui/material/styles'; import { Typography } from '../../atoms/Typography'; import { Button } from '../../atoms/Button'; import { Badge } from '../../atoms/Badge'; import { Card } from '../../atoms/Card'; import { Divider } from '../../atoms/Divider'; import { Link } from '../../atoms/Link'; import type { ComparisonPackage } from '../../organisms/ComparisonTable'; // ─── Types ─────────────────────────────────────────────────────────────────── export interface ComparisonColumnCardProps { /** Package data to render — same shape used by ComparisonTable */ pkg: ComparisonPackage; /** Called when the user clicks the CTA (Make Arrangement / Make Enquiry) */ onArrange: (packageId: string) => void; /** Called when the user clicks Remove — hidden when not provided or for recommended packages */ onRemove?: (packageId: string) => void; /** MUI sx prop for outer wrapper overrides */ sx?: SxProps; } // ─── Helpers ──────────────────────────────────────────────────────────────── function formatPrice(amount: number): string { return `$${amount.toLocaleString('en-AU', { minimumFractionDigits: amount % 1 !== 0 ? 2 : 0 })}`; } // ─── Component ────────────────────────────────────────────────────────────── /** * Desktop column header card for the ComparisonTable. * * Shows provider info (verified badge, name, location, rating), package name, * total price, CTA button, and optional Remove link. The verified badge floats * above the card's top edge. Recommended packages get a copper banner and warm * selected card state. * * Used as the sticky header for each column in the desktop comparison grid. * Mobile comparison uses ComparisonPackageCard instead. */ export const ComparisonColumnCard = React.forwardRef( ({ pkg, onArrange, onRemove, sx }, ref) => { return ( {/* Floating verified badge — overlaps card top edge */} {pkg.provider.verified && ( } sx={{ position: 'absolute', top: -12, left: '50%', transform: 'translateX(-50%)', zIndex: 1, boxShadow: '0 1px 3px rgba(0,0,0,0.1)', }} > Verified )} {pkg.isRecommended && ( Recommended )} {/* Provider name (truncated with tooltip) */} {pkg.provider.name} {/* Location */} {pkg.provider.location} {/* Rating */} {pkg.provider.rating != null && ( {pkg.provider.rating} {pkg.provider.reviewCount != null && ` (${pkg.provider.reviewCount})`} )} {pkg.name} Total package price {formatPrice(pkg.price)} {/* Spacer pushes CTA to bottom across all cards */} {!pkg.isRecommended && onRemove && ( onRemove(pkg.id)} sx={{ mt: 0.5 }} > Remove )} ); }, ); ComparisonColumnCard.displayName = 'ComparisonColumnCard'; export default ComparisonColumnCard;