signal-desktop/ts/components/conversation/ReactionPicker.stories.tsx

74 lines
1.9 KiB
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2020 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
2020-09-09 00:46:29 +00:00
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../../util/setupI18n';
2020-09-09 00:46:29 +00:00
import enMessages from '../../../_locales/en/messages.json';
import type { Props as ReactionPickerProps } from './ReactionPicker';
import { ReactionPicker } from './ReactionPicker';
import { EmojiPicker } from '../emoji/EmojiPicker';
const i18n = setupI18n('en', enMessages);
const preferredReactionEmoji = ['❤️', '👍', '👎', '😂', '😮', '😢'];
const renderEmojiPicker: ReactionPickerProps['renderEmojiPicker'] = ({
onClose,
onPickEmoji,
onSetSkinTone,
ref,
}) => (
<EmojiPicker
i18n={i18n}
skinTone={0}
ref={ref}
onClose={onClose}
onPickEmoji={onPickEmoji}
onSetSkinTone={onSetSkinTone}
/>
);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/Conversation/ReactionPicker',
};
2022-11-18 00:45:19 +00:00
export function Base(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<ReactionPicker
i18n={i18n}
onPick={action('onPick')}
onSetSkinTone={action('onSetSkinTone')}
openCustomizePreferredReactionsModal={action(
'openCustomizePreferredReactionsModal'
)}
preferredReactionEmoji={preferredReactionEmoji}
renderEmojiPicker={renderEmojiPicker}
/>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function SelectedReaction(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{['❤️', '👍', '👎', '😂', '😮', '😢', '😡'].map(e => (
<div key={e} style={{ height: '100px' }}>
<ReactionPicker
i18n={i18n}
selected={e}
onPick={action('onPick')}
onSetSkinTone={action('onSetSkinTone')}
openCustomizePreferredReactionsModal={action(
'openCustomizePreferredReactionsModal'
)}
preferredReactionEmoji={preferredReactionEmoji}
renderEmojiPicker={renderEmojiPicker}
/>
</div>
))}
</>
);
2022-11-18 00:45:19 +00:00
}