import { IdIconProps } from '@transferwise/icons'; import { Flag } from '@wise/art'; import { clsx } from 'clsx'; import { cloneElement, ReactElement, ReactNode } from 'react'; import Body from '../../../Body'; import { Typography } from '../../../common'; export type OptionProps = { label: ReactNode; value: T; currency?: string; note?: ReactNode; secondary?: ReactNode; icon?: ReactNode; /** @deprecated */ classNames?: Record; selected?: boolean; testId?: string; }; function Option({ label, currency = '', note = '', secondary = '', icon, selected = false, testId, }: OptionProps) { const iconElement = icon ? cloneElement(icon as ReactElement, { size: 24, className: 'tw-icon', }) : currency && ; const titleAndNoteElement = ( {label} {note && ( {note} )} ); const secondaryElement = secondary && ( {secondary} ); return iconElement ? (
{iconElement}
{titleAndNoteElement} {secondaryElement}
) : ( <> {iconElement} {titleAndNoteElement} {secondaryElement} ); } export default Option;