// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import { times } from 'lodash'; import { action } from '@storybook/addon-actions'; import type { Meta } from '@storybook/react'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; import { ContactPills } from './ContactPills'; import type { PropsType as ContactPillPropsType } from './ContactPill'; import { ContactPill } from './ContactPill'; import { gifUrl } from '../storybook/Fixtures'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); export default { title: 'Components/Contact Pills', } satisfies Meta; type ContactType = Omit; const contacts: Array = times(50, index => getDefaultConversation({ id: `contact-${index}`, name: `Contact ${index}`, phoneNumber: '(202) 555-0001', profileName: `C${index}`, title: `Contact ${index}`, }) ); const contactPillProps = ( overrideProps?: ContactType ): ContactPillPropsType => ({ ...(overrideProps ?? getDefaultConversation({ avatarPath: gifUrl, firstName: 'John', id: 'abc123', isMe: false, name: 'John Bon Bon Jovi', phoneNumber: '(202) 555-0001', profileName: 'JohnB', title: 'John Bon Bon Jovi', })), i18n, onClickRemove: action('onClickRemove'), }); export function EmptyList(): JSX.Element { return ; } export function OneContact(): JSX.Element { return ( ); } export function ThreeContacts(): JSX.Element { return ( ); } export function FourContactsOneWithALongName(): JSX.Element { return ( ); } export function FiftyContacts(): JSX.Element { return ( {contacts.map(contact => ( ))} ); }