// Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; import { text } from '@storybook/addon-knobs'; import type { Props } from './Emojify'; import { Emojify } from './Emojify'; export default { title: 'Components/Conversation/Emojify', }; const createProps = (overrideProps: Partial = {}): Props => ({ renderNonEmoji: overrideProps.renderNonEmoji, sizeClass: overrideProps.sizeClass, text: text('text', overrideProps.text || ''), }); export function EmojiOnly(): JSX.Element { const props = createProps({ text: '😹😹😹', }); return ; } export function SkinColorModifier(): JSX.Element { const props = createProps({ text: '👍🏾', }); return ; } export function Jumbo(): JSX.Element { const props = createProps({ text: '😹😹😹', sizeClass: 'max', }); return ; } export function ExtraLarge(): JSX.Element { const props = createProps({ text: '😹😹😹', sizeClass: 'extra-large', }); return ; } export function Large(): JSX.Element { const props = createProps({ text: '😹😹😹', sizeClass: 'large', }); return ; } export function Medium(): JSX.Element { const props = createProps({ text: '😹😹😹', sizeClass: 'medium', }); return ; } export function Small(): JSX.Element { const props = createProps({ text: '😹😹😹', sizeClass: 'small', }); return ; } export function PlusText(): JSX.Element { const props = createProps({ text: 'this 😹 cat 😹 is 😹 so 😹 joyful', }); return ; } export function AllTextNoEmoji(): JSX.Element { const props = createProps({ text: 'this cat is so joyful', }); return ; } AllTextNoEmoji.story = { name: 'All Text, No Emoji', }; export function CustomTextRender(): JSX.Element { const props = createProps({ text: 'this 😹 cat 😹 is 😹 so 😹 joyful', renderNonEmoji: ({ text: theText, key }) => (
{theText}
), }); return ; } export function TensOfThousandsOfEmoji(): JSX.Element { const props = createProps({ text: '💅'.repeat(40000), }); return ; } TensOfThousandsOfEmoji.story = { name: 'Tens of thousands of emoji', }; export function TensOfThousandsOfEmojiInterspersedWithText(): JSX.Element { const props = createProps({ text: '💅 hi '.repeat(40000), }); return ; } TensOfThousandsOfEmojiInterspersedWithText.story = { name: 'Tens of thousands of emoji, interspersed with text', };