2021-09-09 16:29:01 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { ComponentProps } from 'react';
|
|
|
|
import React from 'react';
|
2021-09-09 16:29:01 +00:00
|
|
|
|
|
|
|
import { action } from '@storybook/addon-actions';
|
2023-10-11 19:06:43 +00:00
|
|
|
import type { Meta } from '@storybook/react';
|
2021-09-18 00:30:08 +00:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
2023-11-17 20:40:41 +00:00
|
|
|
import { DEFAULT_PREFERRED_REACTION_EMOJI } from '../reactions/constants';
|
2021-09-09 16:29:01 +00:00
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
import type { PropsType } from './CustomizingPreferredReactionsModal';
|
2021-09-09 16:29:01 +00:00
|
|
|
import { CustomizingPreferredReactionsModal } from './CustomizingPreferredReactionsModal';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
2022-06-07 00:48:02 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/CustomizingPreferredReactionsModal',
|
2023-10-11 19:06:43 +00:00
|
|
|
} satisfies Meta<PropsType>;
|
2021-09-09 16:29:01 +00:00
|
|
|
|
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'),
|
2023-11-17 20:40:41 +00:00
|
|
|
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,
|
|
|
|
};
|
2021-09-09 16:29:01 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Default(): JSX.Element {
|
|
|
|
return <CustomizingPreferredReactionsModal {...defaultProps} />;
|
|
|
|
}
|
2021-09-09 16:29:01 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function DraftEmojiSelected(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<CustomizingPreferredReactionsModal
|
|
|
|
{...defaultProps}
|
|
|
|
selectedDraftEmojiIndex={4}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2021-09-09 16:29:01 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Saving(): JSX.Element {
|
|
|
|
return <CustomizingPreferredReactionsModal {...defaultProps} isSaving />;
|
|
|
|
}
|
2021-09-09 16:29:01 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function HadError(): JSX.Element {
|
|
|
|
return <CustomizingPreferredReactionsModal {...defaultProps} hadSaveError />;
|
|
|
|
}
|