2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-05-05 19:49:34 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
2020-09-09 00:46:29 +00:00
|
|
|
|
2020-10-02 20:05:09 +00:00
|
|
|
import { select } from '@storybook/addon-knobs';
|
2020-09-09 00:46:29 +00:00
|
|
|
import { setup as setupI18n } from '../../../js/modules/i18n';
|
|
|
|
import enMessages from '../../../_locales/en/messages.json';
|
2020-05-05 19:49:34 +00:00
|
|
|
import { Props as ReactionPickerProps, ReactionPicker } from './ReactionPicker';
|
|
|
|
import { EmojiPicker } from '../emoji/EmojiPicker';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
const renderEmojiPicker: ReactionPickerProps['renderEmojiPicker'] = ({
|
|
|
|
onClose,
|
|
|
|
onPickEmoji,
|
|
|
|
ref,
|
|
|
|
}) => (
|
|
|
|
<EmojiPicker
|
|
|
|
i18n={i18n}
|
|
|
|
skinTone={0}
|
|
|
|
onSetSkinTone={action('EmojiPicker::onSetSkinTone')}
|
|
|
|
ref={ref}
|
|
|
|
onClose={onClose}
|
|
|
|
onPickEmoji={onPickEmoji}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
|
|
|
storiesOf('Components/Conversation/ReactionPicker', module)
|
|
|
|
.add('Base', () => {
|
|
|
|
return (
|
|
|
|
<ReactionPicker
|
|
|
|
i18n={i18n}
|
|
|
|
onPick={action('onPick')}
|
|
|
|
renderEmojiPicker={renderEmojiPicker}
|
2020-10-02 20:05:09 +00:00
|
|
|
skinTone={0}
|
2020-05-05 19:49:34 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
})
|
|
|
|
.add('Selected Reaction', () => {
|
|
|
|
return ['❤️', '👍', '👎', '😂', '😮', '😢', '😡'].map(e => (
|
|
|
|
<div key={e} style={{ height: '100px' }}>
|
|
|
|
<ReactionPicker
|
|
|
|
i18n={i18n}
|
|
|
|
selected={e}
|
|
|
|
onPick={action('onPick')}
|
|
|
|
renderEmojiPicker={renderEmojiPicker}
|
2020-10-02 20:05:09 +00:00
|
|
|
skinTone={0}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
));
|
|
|
|
})
|
|
|
|
.add('Skin Tones', () => {
|
|
|
|
return ['❤️', '👍', '👎', '😂', '😮', '😢', '😡'].map(e => (
|
|
|
|
<div key={e} style={{ height: '100px' }}>
|
|
|
|
<ReactionPicker
|
|
|
|
i18n={i18n}
|
|
|
|
selected={e}
|
|
|
|
onPick={action('onPick')}
|
|
|
|
renderEmojiPicker={renderEmojiPicker}
|
|
|
|
skinTone={select(
|
|
|
|
'skinTone',
|
|
|
|
{ 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5 },
|
|
|
|
0
|
|
|
|
)}
|
2020-05-05 19:49:34 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
));
|
|
|
|
});
|