2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2019-2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-12-17 20:25:57 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
import { boolean, select, text } from '@storybook/addon-knobs';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
2020-09-14 21:56:35 +00:00
|
|
|
import { StoryRow } from '../elements/StoryRow';
|
|
|
|
import { StickerFrame } from './StickerFrame';
|
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
import type { EmojiPickDataType } from '../../ts/components/emoji/EmojiPicker';
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Sticker Creator/components',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const _StickerFrame = (): JSX.Element => {
|
2019-12-17 20:25:57 +00:00
|
|
|
const image = text('image url', '/fixtures/512x515-thumbs-up-lincoln.webp');
|
|
|
|
const showGuide = boolean('show guide', true);
|
2022-06-13 21:39:35 +00:00
|
|
|
const mode = select('mode', ['removable', 'pick-emoji', 'add'], 'add');
|
2019-12-17 20:25:57 +00:00
|
|
|
const onRemove = action('onRemove');
|
|
|
|
const onDrop = action('onDrop');
|
|
|
|
const [skinTone, setSkinTone] = React.useState(0);
|
2022-06-13 21:39:35 +00:00
|
|
|
const [emoji, setEmoji] = React.useState<EmojiPickDataType | undefined>(
|
|
|
|
undefined
|
|
|
|
);
|
2019-12-17 20:25:57 +00:00
|
|
|
|
|
|
|
return (
|
2020-09-14 21:56:35 +00:00
|
|
|
<StoryRow top>
|
2019-12-17 20:25:57 +00:00
|
|
|
<StickerFrame
|
|
|
|
id="1337"
|
|
|
|
emojiData={emoji}
|
|
|
|
image={image}
|
|
|
|
mode={mode}
|
|
|
|
showGuide={showGuide}
|
|
|
|
onRemove={onRemove}
|
|
|
|
skinTone={skinTone}
|
|
|
|
onSetSkinTone={setSkinTone}
|
|
|
|
onPickEmoji={e => setEmoji(e.emoji)}
|
|
|
|
onDrop={onDrop}
|
|
|
|
/>
|
|
|
|
</StoryRow>
|
|
|
|
);
|
2022-06-07 00:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_StickerFrame.story = {
|
2022-06-14 01:48:07 +00:00
|
|
|
name: 'StickerFrame, add sticker',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const EmojiSelectMode = (): JSX.Element => {
|
|
|
|
const image = text('image url', '/fixtures/512x515-thumbs-up-lincoln.webp');
|
|
|
|
const setSkinTone = action('setSkinTone');
|
|
|
|
const onRemove = action('onRemove');
|
|
|
|
const onDrop = action('onDrop');
|
|
|
|
const [emoji, setEmoji] = React.useState<EmojiPickDataType | undefined>(
|
|
|
|
undefined
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<StoryRow top>
|
|
|
|
<StickerFrame
|
|
|
|
id="1337"
|
|
|
|
emojiData={emoji}
|
|
|
|
image={image}
|
|
|
|
mode="pick-emoji"
|
|
|
|
onRemove={onRemove}
|
|
|
|
skinTone={0}
|
|
|
|
onSetSkinTone={setSkinTone}
|
|
|
|
onPickEmoji={e => setEmoji(e.emoji)}
|
|
|
|
onDrop={onDrop}
|
|
|
|
/>
|
|
|
|
</StoryRow>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
EmojiSelectMode.story = {
|
|
|
|
name: 'StickerFrame, emoji select mode',
|
2022-06-07 00:48:02 +00:00
|
|
|
};
|