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';
|
|
|
|
|
2023-10-11 12:06:43 -07:00
|
|
|
import type { Meta } from '@storybook/react';
|
2021-08-05 20:17:05 -04:00
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
import { AvatarColors } from '../types/Colors';
|
2021-10-26 14:15:33 -05:00
|
|
|
import type { PropsType } from './BetterAvatarBubble';
|
|
|
|
import { BetterAvatarBubble } from './BetterAvatarBubble';
|
2021-09-17 20:30:08 -04:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
2021-08-05 20:17:05 -04:00
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
|
|
|
|
children: overrideProps.children,
|
|
|
|
color: overrideProps.color,
|
|
|
|
i18n,
|
|
|
|
isSelected: Boolean(overrideProps.isSelected),
|
|
|
|
onDelete: action('onDelete'),
|
|
|
|
onSelect: action('onSelect'),
|
|
|
|
style: overrideProps.style,
|
|
|
|
});
|
|
|
|
|
2022-06-06 20:48:02 -04:00
|
|
|
export default {
|
|
|
|
title: 'Components/BetterAvatarBubble',
|
2023-10-11 12:06:43 -07:00
|
|
|
} satisfies Meta<PropsType>;
|
2021-08-05 20:17:05 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function Children(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<BetterAvatarBubble
|
|
|
|
{...createProps({
|
|
|
|
children: <div>HI</div>,
|
|
|
|
color: AvatarColors[8],
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Selected(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<BetterAvatarBubble
|
|
|
|
{...createProps({
|
|
|
|
color: AvatarColors[1],
|
|
|
|
isSelected: true,
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Style(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<BetterAvatarBubble
|
|
|
|
{...createProps({
|
|
|
|
style: {
|
|
|
|
height: 120,
|
|
|
|
width: 120,
|
|
|
|
},
|
|
|
|
color: AvatarColors[2],
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|