signal-desktop/ts/components/conversation/Emojify.stories.tsx

140 lines
2.9 KiB
TypeScript
Raw Normal View History

2020-10-30 15:34:04 -05:00
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2020-08-21 10:27:37 -07:00
import * as React from 'react';
import type { Meta } from '@storybook/react';
import type { Props } from './Emojify';
import { Emojify } from './Emojify';
2020-08-21 10:27:37 -07:00
2022-06-06 20:48:02 -04:00
export default {
title: 'Components/Conversation/Emojify',
} satisfies Meta<Props>;
2020-08-21 10:27:37 -07:00
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
renderNonEmoji: overrideProps.renderNonEmoji,
2025-03-26 12:35:32 -07:00
fontSizeOverride: overrideProps.fontSizeOverride,
text: overrideProps.text || '',
2020-08-21 10:27:37 -07:00
});
2022-11-17 16:45:19 -08:00
export function EmojiOnly(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: '😹😹😹',
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 10:27:37 -07:00
2022-11-17 16:45:19 -08:00
export function SkinColorModifier(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: '👍🏾',
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 10:27:37 -07:00
2022-11-17 16:45:19 -08:00
export function Jumbo(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: '😹😹😹',
2025-03-26 12:35:32 -07:00
fontSizeOverride: 56,
2021-10-06 13:37:53 -04:00
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2021-10-06 13:37:53 -04:00
2022-11-17 16:45:19 -08:00
export function ExtraLarge(): JSX.Element {
2021-10-06 13:37:53 -04:00
const props = createProps({
text: '😹😹😹',
2025-03-26 12:35:32 -07:00
fontSizeOverride: 48,
2020-08-21 10:27:37 -07:00
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 10:27:37 -07:00
2022-11-17 16:45:19 -08:00
export function Large(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: '😹😹😹',
2025-03-26 12:35:32 -07:00
fontSizeOverride: 40,
2020-08-21 10:27:37 -07:00
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 10:27:37 -07:00
2022-11-17 16:45:19 -08:00
export function Medium(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: '😹😹😹',
2025-03-26 12:35:32 -07:00
fontSizeOverride: 36,
2020-08-21 10:27:37 -07:00
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 10:27:37 -07:00
2022-11-17 16:45:19 -08:00
export function Small(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: '😹😹😹',
2025-03-26 12:35:32 -07:00
fontSizeOverride: 32,
2020-08-21 10:27:37 -07:00
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 10:27:37 -07:00
2022-11-17 16:45:19 -08:00
export function PlusText(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: 'this 😹 cat 😹 is 😹 so 😹 joyful',
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 10:27:37 -07:00
2022-11-17 16:45:19 -08:00
export function AllTextNoEmoji(): JSX.Element {
2020-08-21 10:27:37 -07:00
const props = createProps({
text: 'this cat is so joyful',
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2022-06-06 20:48:02 -04:00
2022-11-17 16:45:19 -08:00
export function CustomTextRender(): JSX.Element {
2020-08-21 10:27:37 -07: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-17 16:45:19 -08:00
}
2022-11-17 16:45:19 -08:00
export function TensOfThousandsOfEmoji(): JSX.Element {
const props = createProps({
text: '💅'.repeat(40000),
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
2022-11-17 16:45:19 -08:00
export function TensOfThousandsOfEmojiInterspersedWithText(): JSX.Element {
const props = createProps({
text: '💅 hi '.repeat(40000),
});
return <Emojify {...props} />;
2022-11-17 16:45:19 -08:00
}
export function NonQualifiedEmoji(): JSX.Element {
const props = createProps({
text: '\u{00AE}',
});
return <Emojify {...props} />;
}
export function OverlyQualifiedEmoji(): JSX.Element {
const props = createProps({
text: '\u{26AA}\u{FE0F}',
});
return <Emojify {...props} />;
}