import clsx from 'clsx'; import type { FunctionComponent, MouseEvent } from 'react'; import React from 'react'; import { RemoveButton } from '../RemoveButton'; import styles from './styles.scss'; export interface RecipientProps { phoneNumber: string; name?: string; title?: string; isWarning?: boolean; onRemove: (ev: MouseEvent) => void; } const Recipient: FunctionComponent = ({ phoneNumber, name = phoneNumber, title = name, isWarning = false, onRemove, }) => { let className = phoneNumber.length > 5 ? styles.phoneNumber : styles.extension; if (isWarning) className = styles.warningRecipient; return (
  • {name}
  • ); }; export interface BasicRecipientInfo { phoneNumber: string; name?: string; } export interface SelectedRecipientsProps { onRemove: (phoneNumber: string) => void; className?: string; recipients: BasicRecipientInfo[]; } export const SelectedRecipients: FunctionComponent = ({ recipients, onRemove, className, }) => { if (recipients.length) { return ( ); } return null; };