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

64 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-03-04 21:14:52 +00:00
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2022-07-01 00:52:03 +00:00
import type { Meta, Story } from '@storybook/react';
2022-03-04 21:14:52 +00:00
import React from 'react';
import type { PropsType } from './StoryListItem';
import { StoryListItem } from './StoryListItem';
import enMessages from '../../_locales/en/messages.json';
import { setupI18n } from '../util/setupI18n';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import {
fakeAttachment,
fakeThumbnail,
} from '../test-both/helpers/fakeAttachment';
const i18n = setupI18n('en', enMessages);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/StoryListItem',
2022-07-01 00:52:03 +00:00
component: StoryListItem,
argTypes: {
conversationId: {
defaultValue: getDefaultConversation().id,
},
getPreferredBadge: { action: true },
2022-07-01 00:52:03 +00:00
i18n: {
defaultValue: i18n,
},
onGoToConversation: { action: true },
onHideStory: { action: true },
queueStoryDownload: { action: true },
2022-03-04 21:14:52 +00:00
story: {
2022-07-01 00:52:03 +00:00
defaultValue: {
messageId: '123',
sender: getDefaultConversation(),
timestamp: Date.now(),
},
2022-03-04 21:14:52 +00:00
},
2022-07-25 18:55:44 +00:00
viewUserStories: { action: true },
2022-07-01 00:52:03 +00:00
},
} as Meta;
const Template: Story<PropsType> = args => <StoryListItem {...args} />;
export const SomeonesStory = Template.bind({});
SomeonesStory.args = {
group: getDefaultConversation({ title: 'Sports Group' }),
story: {
attachment: fakeAttachment({
thumbnail: fakeThumbnail('/fixtures/tina-rolf-269345-unsplash.jpg'),
}),
hasReplies: true,
isUnread: true,
messageId: '123',
sender: getDefaultConversation(),
timestamp: Date.now(),
expirationTimestamp: undefined,
2022-07-01 00:52:03 +00:00
},
2022-06-07 00:48:02 +00:00
};
SomeonesStory.story = {
name: "Someone's story",
};