import React from 'react'; import { useNavigate } from 'react-router-dom'; import type { ShippingAddressOption } from '../../data/checkoutData'; import { tr } from '../../lib/cookies'; import { ROUTES } from '../../lib/routes'; interface AddressCardProps { item: ShippingAddressOption; variant: 'checkout' | 'manage'; onSelect?: () => void; onEdit?: () => void; onDelete?: () => void; onChangeAddressClick?: () => void; } export const AddressCard: React.FC = ({ item, variant, onSelect, onEdit, onDelete, onChangeAddressClick, }) => { const navigate = useNavigate(); return (
{/* Radio Indicator 20x20 */}
{item.selected && (
)}
{/* Right Content */}
{/* Top Row */}
{item.name} {variant === 'checkout' ? ( { e.stopPropagation(); if (onChangeAddressClick) { onChangeAddressClick(); } else { navigate(ROUTES.addresses); } }} style={{ fontFamily: 'var(--font-sans)', fontWeight: 600, fontSize: '8.5px', lineHeight: '12.52px', color: '#d78e06', textAlign: 'center', cursor: 'pointer', flexShrink: 0, }} > {tr('Change Adress')} ) : (
Delete or Edit {onDelete && (
)}
{/* Address Text */}
{item.address}
); }; interface AddNewAddressCardProps { left?: number; top?: number; onClick?: () => void; } export const AddNewAddressCard: React.FC = ({ onClick }) => { return (
+
{tr('Add New adress')} {tr('Add New Delivery adress')}
); };