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

60 lines
1.8 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
import type { Meta, StoryFn } from '@storybook/react';
2022-03-04 21:14:52 +00:00
import React from 'react';
import { action } from '@storybook/addon-actions';
2022-03-04 21:14:52 +00:00
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,
args: {
conversationId: getDefaultConversation().id,
getPreferredBadge: () => undefined,
i18n,
onGoToConversation: action('onGoToConversation'),
onHideStory: action('onHideStory'),
queueStoryDownload: action('queueStoryDownload'),
2022-03-04 21:14:52 +00:00
story: {
messageId: '123',
sender: getDefaultConversation(),
timestamp: Date.now(),
messageIdForLogging: '123',
expirationTimestamp: undefined,
2022-03-04 21:14:52 +00:00
},
viewUserStories: action('viewUserStories'),
2022-07-01 00:52:03 +00:00
},
} satisfies Meta<PropsType>;
2022-07-01 00:52:03 +00:00
2022-11-18 00:45:19 +00:00
// eslint-disable-next-line react/function-component-definition
const Template: StoryFn<PropsType> = args => <StoryListItem {...args} />;
2022-07-01 00:52:03 +00:00
export const SomeonesStory = Template.bind({});
SomeonesStory.args = {
hasReplies: true,
2022-07-01 00:52:03 +00:00
group: getDefaultConversation({ title: 'Sports Group' }),
story: {
attachment: fakeAttachment({
thumbnail: fakeThumbnail('/fixtures/tina-rolf-269345-unsplash.jpg'),
}),
isUnread: true,
messageId: '123',
messageIdForLogging: 'for logging 123',
2022-07-01 00:52:03 +00:00
sender: getDefaultConversation(),
timestamp: Date.now(),
expirationTimestamp: undefined,
2022-07-01 00:52:03 +00:00
},
2022-06-07 00:48:02 +00:00
};