2017-09-27 20:32:48 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
2017-09-28 00:58:02 +00:00
|
|
|
import { withKnobs, text, boolean, number, select, color } from '@storybook/addon-knobs';
|
2017-09-27 20:32:48 +00:00
|
|
|
|
2017-09-29 18:32:57 +00:00
|
|
|
import { Picker, Emoji, emojiIndex } from '../dist';
|
2017-09-27 20:32:48 +00:00
|
|
|
import '../css/emoji-mart.css';
|
|
|
|
|
2017-09-28 00:58:02 +00:00
|
|
|
const SETS = ['apple', 'google', 'twitter', 'emojione', 'messenger', 'facebook']
|
2017-09-28 02:02:47 +00:00
|
|
|
const CUSTOM_EMOJIS = [
|
|
|
|
{
|
|
|
|
name: 'Octocat',
|
|
|
|
short_names: ['octocat'],
|
|
|
|
keywords: ['github'],
|
|
|
|
imageUrl: 'https://assets-cdn.github.com/images/icons/emoji/octocat.png?v7'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Squirrel',
|
|
|
|
short_names: ['shipit', 'squirrel'],
|
|
|
|
keywords: ['github'],
|
|
|
|
imageUrl: 'https://assets-cdn.github.com/images/icons/emoji/shipit.png?v7'
|
|
|
|
}
|
|
|
|
]
|
2017-09-28 00:58:02 +00:00
|
|
|
|
2017-09-27 20:32:48 +00:00
|
|
|
storiesOf('Picker', module)
|
|
|
|
.addDecorator(withKnobs)
|
|
|
|
.add('default', () => (
|
|
|
|
<Picker
|
|
|
|
onClick={action('clicked')}
|
2018-03-02 18:33:14 +00:00
|
|
|
onSkinChange={action('skin changed')}
|
2017-09-28 00:58:02 +00:00
|
|
|
native={boolean('Unicode', true)}
|
|
|
|
set={select('Emoji pack', SETS, SETS[0])}
|
2017-09-27 20:32:48 +00:00
|
|
|
emojiSize={number('Emoji size', 24)}
|
|
|
|
perLine={number('Per line', 9)}
|
|
|
|
title={text('Idle text', 'Your Title Here')}
|
|
|
|
emoji={text('Idle emoji', 'department_store')}
|
2018-03-02 18:45:33 +00:00
|
|
|
defaultSkin={number('Default skin tone', 1)}
|
2017-09-28 00:58:02 +00:00
|
|
|
color={color('Highlight color', '#ae65c5')}
|
2017-09-28 02:02:30 +00:00
|
|
|
showPreview={boolean('Show preview', true)}
|
2018-03-02 20:08:52 +00:00
|
|
|
showSkinTones={boolean('Show skin tones', true)}
|
2017-09-28 02:02:47 +00:00
|
|
|
custom={CUSTOM_EMOJIS}
|
2017-09-27 20:32:48 +00:00
|
|
|
/>
|
|
|
|
));
|
|
|
|
|
|
|
|
storiesOf('Emoji', module)
|
|
|
|
.addDecorator(withKnobs)
|
|
|
|
.add('default', () => (
|
|
|
|
<Emoji
|
2017-09-28 00:58:02 +00:00
|
|
|
native={boolean('Unicode', true)}
|
|
|
|
set={select('Emoji pack', SETS, SETS[0])}
|
2017-09-27 20:32:48 +00:00
|
|
|
emoji={text('Emoji', '+1')}
|
|
|
|
size={number('Emoji size', 64)}
|
|
|
|
skin={number('Skin tone', 1)}
|
2018-01-09 20:14:54 +00:00
|
|
|
html={boolean('HTML', false)}
|
2018-01-09 19:19:57 +00:00
|
|
|
fallback={(emoji) => {
|
|
|
|
return `:${emoji.short_names[0]}:`
|
|
|
|
}}
|
2017-09-27 20:32:48 +00:00
|
|
|
/>
|
|
|
|
));
|
2017-09-28 02:20:56 +00:00
|
|
|
|
|
|
|
storiesOf('Headless Search', module)
|
|
|
|
.addDecorator(withKnobs)
|
2017-09-30 14:37:13 +00:00
|
|
|
.add('default', () => {
|
|
|
|
let results = emojiIndex.search(text('Search', 'christmas'), { custom: CUSTOM_EMOJIS })
|
|
|
|
if (!results) { return null }
|
|
|
|
|
|
|
|
return <div>
|
|
|
|
{results.map((emoji) => {
|
|
|
|
return <span key={emoji.id} style={{ marginLeft: '1.4em' }}>
|
|
|
|
<Emoji native={true} emoji={emoji} size={48} />
|
|
|
|
</span>
|
2017-09-28 02:20:56 +00:00
|
|
|
})}
|
|
|
|
</div>
|
2017-09-30 14:37:13 +00:00
|
|
|
});
|