// 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 './StoryViewer'; import { StoryViewer } from './StoryViewer'; import enMessages from '../../_locales/en/messages.json'; import { setupI18n } from '../util/setupI18n'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { fakeAttachment } from '../test-both/helpers/fakeAttachment'; const i18n = setupI18n('en', enMessages); export default { title: 'Components/StoryViewer', }; function getDefaultProps(): PropsType { const sender = getDefaultConversation(); return { conversationId: sender.id, getPreferredBadge: () => undefined, group: undefined, hasAllStoriesMuted: false, i18n, loadStoryReplies: action('loadStoryReplies'), markStoryRead: action('markStoryRead'), onClose: action('onClose'), onGoToConversation: action('onGoToConversation'), onHideStory: action('onHideStory'), onNextUserStories: action('onNextUserStories'), onPrevUserStories: action('onPrevUserStories'), onReactToStory: action('onReactToStory'), onReplyToStory: action('onReplyToStory'), onSetSkinTone: action('onSetSkinTone'), onTextTooLong: action('onTextTooLong'), onUseEmoji: action('onUseEmoji'), preferredReactionEmoji: ['❤️', '👍', '👎', '😂', '😮', '😢'], queueStoryDownload: action('queueStoryDownload'), renderEmojiPicker: () =>
, stories: [ { attachment: fakeAttachment({ path: 'snow.jpg', url: '/fixtures/snow.jpg', }), canReply: true, messageId: '123', sender, timestamp: Date.now(), }, ], toggleHasAllStoriesMuted: action('toggleHasAllStoriesMuted'), }; } export const SomeonesStory = (): JSX.Element => ( ); SomeonesStory.story = { name: "Someone's story", }; export const WideStory = (): JSX.Element => ( ); WideStory.story = { name: 'Wide story', }; export const InAGroup = (): JSX.Element => ( ); InAGroup.story = { name: 'In a group', }; export const MultiStory = (): JSX.Element => { const sender = getDefaultConversation(); return ( ); }; MultiStory.story = { name: 'Multi story', }; export const Caption = (): JSX.Element => ( ); export const LongCaption = (): JSX.Element => ( );