2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-08-21 17:27:37 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
import { text } from '@storybook/addon-knobs';
|
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { Props } from './Emojify';
|
|
|
|
import { Emojify } from './Emojify';
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/Conversation/Emojify',
|
|
|
|
};
|
2020-08-21 17:27:37 +00:00
|
|
|
|
|
|
|
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
|
|
|
renderNonEmoji: overrideProps.renderNonEmoji,
|
|
|
|
sizeClass: overrideProps.sizeClass,
|
|
|
|
text: text('text', overrideProps.text || ''),
|
|
|
|
});
|
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function EmojiOnly(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '😹😹😹',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function SkinColorModifier(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '👍🏾',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Jumbo(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '😹😹😹',
|
2021-10-06 17:37:53 +00:00
|
|
|
sizeClass: 'max',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2021-10-06 17:37:53 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function ExtraLarge(): JSX.Element {
|
2021-10-06 17:37:53 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '😹😹😹',
|
|
|
|
sizeClass: 'extra-large',
|
2020-08-21 17:27:37 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Large(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '😹😹😹',
|
|
|
|
sizeClass: 'large',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Medium(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '😹😹😹',
|
|
|
|
sizeClass: 'medium',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Small(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '😹😹😹',
|
|
|
|
sizeClass: 'small',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function PlusText(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: 'this 😹 cat 😹 is 😹 so 😹 joyful',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function AllTextNoEmoji(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: 'this cat is so joyful',
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2022-06-07 00:48:02 +00:00
|
|
|
|
|
|
|
AllTextNoEmoji.story = {
|
|
|
|
name: 'All Text, No Emoji',
|
|
|
|
};
|
2020-08-21 17:27:37 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function CustomTextRender(): JSX.Element {
|
2020-08-21 17:27:37 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: 'this 😹 cat 😹 is 😹 so 😹 joyful',
|
|
|
|
renderNonEmoji: ({ text: theText, key }) => (
|
|
|
|
<div key={key} style={{ backgroundColor: 'aquamarine' }}>
|
|
|
|
{theText}
|
|
|
|
</div>
|
|
|
|
),
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2021-08-30 16:39:03 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function TensOfThousandsOfEmoji(): JSX.Element {
|
2021-08-30 16:39:03 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '💅'.repeat(40000),
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2021-08-30 16:39:03 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
TensOfThousandsOfEmoji.story = {
|
|
|
|
name: 'Tens of thousands of emoji',
|
|
|
|
};
|
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function TensOfThousandsOfEmojiInterspersedWithText(): JSX.Element {
|
2021-08-30 16:39:03 +00:00
|
|
|
const props = createProps({
|
|
|
|
text: '💅 hi '.repeat(40000),
|
|
|
|
});
|
|
|
|
|
|
|
|
return <Emojify {...props} />;
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2022-06-07 00:48:02 +00:00
|
|
|
|
|
|
|
TensOfThousandsOfEmojiInterspersedWithText.story = {
|
|
|
|
name: 'Tens of thousands of emoji, interspersed with text',
|
|
|
|
};
|