signal-desktop/ts/components/AvatarTextEditor.stories.tsx

56 lines
1.2 KiB
TypeScript
Raw Normal View History

2021-08-05 20:17:05 -04:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './AvatarTextEditor';
import { AvatarTextEditor } from './AvatarTextEditor';
2021-08-05 20:17:05 -04:00
import { AvatarColors } from '../types/Colors';
2025-03-13 12:52:08 -07:00
const { i18n } = window.SignalContext;
2021-08-05 20:17:05 -04:00
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
avatarData: overrideProps.avatarData,
i18n,
onCancel: action('onCancel'),
onDone: action('onDone'),
});
2022-06-06 20:48:02 -04:00
export default {
title: 'Components/AvatarTextEditor',
} satisfies Meta<PropsType>;
2021-08-05 20:17:05 -04:00
2022-11-17 16:45:19 -08:00
export function Empty(): JSX.Element {
return <AvatarTextEditor {...createProps()} />;
}
export function WithData(): JSX.Element {
return (
<AvatarTextEditor
{...createProps({
avatarData: {
id: '123',
color: AvatarColors[6],
text: 'SUP',
},
})}
/>
);
}
2021-08-05 20:17:05 -04:00
2022-11-17 16:45:19 -08:00
export function WithWideCharacters(): JSX.Element {
return (
<AvatarTextEditor
{...createProps({
avatarData: {
id: '123',
color: AvatarColors[6],
text: '‱௸𒈙',
},
})}
/>
);
}