signal-desktop/ts/components/StoryDetailsModal.stories.tsx

82 lines
2.2 KiB
TypeScript
Raw Normal View History

2022-07-25 18:55:44 +00:00
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { Meta, StoryFn } from '@storybook/react';
2022-07-25 18:55:44 +00:00
import React from 'react';
import casual from 'casual';
import { action } from '@storybook/addon-actions';
2022-07-25 18:55:44 +00:00
import type { PropsType } from './StoryDetailsModal';
import enMessages from '../../_locales/en/messages.json';
import { SendStatus } from '../messages/MessageSendState';
import { StoryDetailsModal } from './StoryDetailsModal';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
export default {
title: 'Components/StoryDetailsModal',
component: StoryDetailsModal,
args: {
getPreferredBadge: () => undefined,
i18n,
onClose: action('onClose'),
sender: getDefaultConversation(),
sendState: undefined,
timestamp: Date.now(),
2022-07-25 18:55:44 +00:00
},
} satisfies Meta<PropsType>;
2022-07-25 18:55:44 +00:00
2022-11-18 00:45:19 +00:00
// eslint-disable-next-line react/function-component-definition
const Template: StoryFn<PropsType> = args => <StoryDetailsModal {...args} />;
2022-07-25 18:55:44 +00:00
export const MyStory = Template.bind({});
MyStory.args = {
sendState: [
{
recipient: getDefaultConversation(),
status: SendStatus.Delivered,
updatedAt: casual.unix_time,
},
{
recipient: getDefaultConversation(),
status: SendStatus.Delivered,
updatedAt: casual.unix_time,
},
{
recipient: getDefaultConversation(),
status: SendStatus.Delivered,
updatedAt: casual.unix_time,
},
{
recipient: getDefaultConversation(),
status: SendStatus.Delivered,
updatedAt: casual.unix_time,
},
{
recipient: getDefaultConversation(),
status: SendStatus.Sent,
updatedAt: casual.unix_time,
},
{
recipient: getDefaultConversation(),
status: SendStatus.Viewed,
updatedAt: casual.unix_time,
},
{
recipient: getDefaultConversation(),
status: SendStatus.Viewed,
updatedAt: casual.unix_time,
},
{
recipient: getDefaultConversation(),
status: SendStatus.Viewed,
updatedAt: casual.unix_time,
},
],
};
export const OtherStory = Template.bind({});
OtherStory.args = {};