Send text attachment stories

This commit is contained in:
Josh Perez 2022-08-02 15:31:55 -04:00 committed by GitHub
parent 0340f4ee1d
commit 9eff67446f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 1635 additions and 339 deletions

View file

@ -3,12 +3,13 @@
import type { Meta, Story } from '@storybook/react';
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './StoryCreator';
import enMessages from '../../_locales/en/messages.json';
import { StoryCreator } from './StoryCreator';
import { fakeAttachment } from '../test-both/helpers/fakeAttachment';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { getFakeDistributionLists } from '../test-both/helpers/getFakeDistributionLists';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
@ -16,26 +17,34 @@ const i18n = setupI18n('en', enMessages);
export default {
title: 'Components/StoryCreator',
component: StoryCreator,
argTypes: {
debouncedMaybeGrabLinkPreview: { action: true },
distributionLists: { defaultValue: getFakeDistributionLists() },
linkPreview: {
defaultValue: undefined,
},
i18n: { defaultValue: i18n },
me: {
defaultValue: getDefaultConversation(),
},
onClose: { action: true },
onSend: { action: true },
signalConnections: {
defaultValue: Array.from(Array(42), getDefaultConversation),
},
},
} as Meta;
const getDefaultProps = (): PropsType => ({
debouncedMaybeGrabLinkPreview: action('debouncedMaybeGrabLinkPreview'),
i18n,
onClose: action('onClose'),
onNext: action('onNext'),
});
const Template: Story<PropsType> = args => <StoryCreator {...args} />;
export const Default = Template.bind({});
Default.args = getDefaultProps();
Default.args = {};
Default.story = {
name: 'w/o Link Preview available',
};
export const LinkPreview = Template.bind({});
LinkPreview.args = {
...getDefaultProps(),
linkPreview: {
domain: 'www.catsandkittens.lolcats',
image: fakeAttachment({