2022-03-04 21:14:52 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
|
|
|
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-03-04 21:14:52 +00:00
|
|
|
|
|
|
|
function getDefaultProps(): PropsType {
|
|
|
|
return {
|
|
|
|
i18n,
|
|
|
|
onClick: action('onClick'),
|
2022-04-29 17:43:24 +00:00
|
|
|
onGoToConversation: action('onGoToConversation'),
|
|
|
|
onHideStory: action('onHideStory'),
|
2022-03-29 01:10:08 +00:00
|
|
|
queueStoryDownload: action('queueStoryDownload'),
|
2022-03-04 21:14:52 +00:00
|
|
|
story: {
|
|
|
|
messageId: '123',
|
|
|
|
sender: getDefaultConversation(),
|
|
|
|
timestamp: Date.now(),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const MyStory = (): JSX.Element => (
|
2022-03-04 21:14:52 +00:00
|
|
|
<StoryListItem
|
|
|
|
{...getDefaultProps()}
|
|
|
|
story={{
|
|
|
|
messageId: '123',
|
|
|
|
sender: getDefaultConversation({ isMe: true }),
|
|
|
|
timestamp: Date.now(),
|
|
|
|
}}
|
|
|
|
/>
|
2022-06-07 00:48:02 +00:00
|
|
|
);
|
2022-03-04 21:14:52 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const MyStoryMany = (): JSX.Element => (
|
2022-03-04 21:14:52 +00:00
|
|
|
<StoryListItem
|
|
|
|
{...getDefaultProps()}
|
|
|
|
story={{
|
|
|
|
attachment: fakeAttachment({
|
|
|
|
thumbnail: fakeThumbnail(
|
|
|
|
'/fixtures/nathan-anderson-316188-unsplash.jpg'
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
messageId: '123',
|
|
|
|
sender: getDefaultConversation({ isMe: true }),
|
|
|
|
timestamp: Date.now(),
|
|
|
|
}}
|
|
|
|
hasMultiple
|
|
|
|
/>
|
2022-06-07 00:48:02 +00:00
|
|
|
);
|
2022-03-04 21:14:52 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
MyStoryMany.story = {
|
|
|
|
name: 'My Story (many)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SomeonesStory = (): JSX.Element => (
|
2022-03-04 21:14:52 +00:00
|
|
|
<StoryListItem
|
|
|
|
{...getDefaultProps()}
|
2022-04-15 00:08:46 +00:00
|
|
|
group={getDefaultConversation({ title: 'Sports Group' })}
|
2022-03-04 21:14:52 +00:00
|
|
|
story={{
|
|
|
|
attachment: fakeAttachment({
|
|
|
|
thumbnail: fakeThumbnail('/fixtures/tina-rolf-269345-unsplash.jpg'),
|
|
|
|
}),
|
|
|
|
hasReplies: true,
|
|
|
|
isUnread: true,
|
|
|
|
messageId: '123',
|
|
|
|
sender: getDefaultConversation(),
|
|
|
|
timestamp: Date.now(),
|
|
|
|
}}
|
|
|
|
/>
|
2022-06-07 00:48:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
SomeonesStory.story = {
|
|
|
|
name: "Someone's story",
|
|
|
|
};
|