2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-08-20 22:04:59 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
2020-11-06 20:11:18 +00:00
|
|
|
import { select, text } from '@storybook/addon-knobs';
|
2020-09-01 00:09:28 +00:00
|
|
|
import { Emoji, EmojiSizes, Props } from './Emoji';
|
2020-08-20 22:04:59 +00:00
|
|
|
|
|
|
|
const story = storiesOf('Components/Emoji/Emoji', module);
|
|
|
|
|
|
|
|
const tones = [0, 1, 2, 3, 4, 5];
|
|
|
|
|
|
|
|
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
|
|
|
size: select(
|
|
|
|
'size',
|
|
|
|
EmojiSizes.reduce((m, t) => ({ ...m, [t]: t }), {}),
|
|
|
|
overrideProps.size || 48
|
|
|
|
),
|
|
|
|
emoji: text('emoji', overrideProps.emoji || ''),
|
|
|
|
shortName: text('shortName', overrideProps.shortName || ''),
|
|
|
|
skinTone: select(
|
|
|
|
'skinTone',
|
|
|
|
tones.reduce((m, t) => ({ ...m, [t]: t }), {}),
|
|
|
|
overrideProps.skinTone || 0
|
|
|
|
),
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('Sizes', () => {
|
|
|
|
const props = createProps({
|
|
|
|
shortName: 'grinning_face_with_star_eyes',
|
|
|
|
});
|
|
|
|
|
|
|
|
return EmojiSizes.map(size => <Emoji key={size} {...props} size={size} />);
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('Skin Tones', () => {
|
|
|
|
const props = createProps({
|
|
|
|
shortName: 'raised_back_of_hand',
|
|
|
|
});
|
|
|
|
|
|
|
|
return tones.map(skinTone => (
|
|
|
|
<Emoji key={skinTone} {...props} skinTone={skinTone} />
|
|
|
|
));
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('From Emoji', () => {
|
|
|
|
const props = createProps({
|
|
|
|
emoji: '😂',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emoji {...props} />;
|
|
|
|
});
|