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

63 lines
2.1 KiB
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ComponentProps } from 'react';
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../util/setupI18n';
import { DEFAULT_PREFERRED_REACTION_EMOJI } from '../reactions/constants';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './CustomizingPreferredReactionsModal';
import { CustomizingPreferredReactionsModal } from './CustomizingPreferredReactionsModal';
const i18n = setupI18n('en', enMessages);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/CustomizingPreferredReactionsModal',
} satisfies Meta<PropsType>;
2021-11-11 22:43:05 +00:00
const defaultProps: ComponentProps<typeof CustomizingPreferredReactionsModal> =
{
cancelCustomizePreferredReactionsModal: action(
'cancelCustomizePreferredReactionsModal'
),
deselectDraftEmoji: action('deselectDraftEmoji'),
draftPreferredReactions: ['✨', '❇️', '🎇', '🦈', '💖', '🅿️'],
hadSaveError: false,
i18n,
isSaving: false,
onSetSkinTone: action('onSetSkinTone'),
originalPreferredReactions: DEFAULT_PREFERRED_REACTION_EMOJI,
2021-11-11 22:43:05 +00:00
recentEmojis: ['cake'],
replaceSelectedDraftEmoji: action('replaceSelectedDraftEmoji'),
resetDraftEmoji: action('resetDraftEmoji'),
savePreferredReactions: action('savePreferredReactions'),
selectDraftEmojiToBeReplaced: action('selectDraftEmojiToBeReplaced'),
selectedDraftEmojiIndex: undefined,
skinTone: 4,
};
2022-11-18 00:45:19 +00:00
export function Default(): JSX.Element {
return <CustomizingPreferredReactionsModal {...defaultProps} />;
}
2022-11-18 00:45:19 +00:00
export function DraftEmojiSelected(): JSX.Element {
return (
<CustomizingPreferredReactionsModal
{...defaultProps}
selectedDraftEmojiIndex={4}
/>
);
}
2022-11-18 00:45:19 +00:00
export function Saving(): JSX.Element {
return <CustomizingPreferredReactionsModal {...defaultProps} isSaving />;
}
2022-11-18 00:45:19 +00:00
export function HadError(): JSX.Element {
return <CustomizingPreferredReactionsModal {...defaultProps} hadSaveError />;
}