import React from "react"; import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; const countryCodeFormatter = new Intl.DisplayNames("en", { type: "region" }); export interface AddressInfoProps { name?: string; streetAddress: string; streetAddress2?: string; careOf?: string; postalCode: string; city: string; region?: string; countryCode: string; } export const AddressInfo: React.FC = ({ name, streetAddress, streetAddress2, careOf, postalCode, city, region, countryCode, }) => { return ( {name != null && name !== "" ? {name} : null} {careOf != null && careOf !== "" ? c/o {careOf} : null} {streetAddress} {streetAddress2 != null && streetAddress2 !== "" ? ( {streetAddress2} ) : null} {`${postalCode} ${city}`} {region != null && region !== "" ? {region} : null} {countryCode != null && countryCode !== "" ? ( {countryCodeFormatter.of(countryCode)} ) : null} ); };