signal-desktop/ts/components/stickers/StickerPicker.stories.tsx

79 lines
2 KiB
TypeScript
Raw Normal View History

2020-10-30 20:34:04 +00:00
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../../util/setupI18n';
import enMessages from '../../../_locales/en/messages.json';
import type { Props } from './StickerPicker';
import { StickerPicker } from './StickerPicker';
import { abeSticker, createPack, packs, recentStickers } from './mocks';
const i18n = setupI18n('en', enMessages);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/Stickers/StickerPicker',
component: StickerPicker,
argTypes: {
showPickerHint: { control: { type: 'boolean' } },
},
args: {
i18n,
onClickAddPack: action('onClickAddPack'),
onClose: action('onClose'),
onPickSticker: action('onPickSticker'),
packs: [],
recentStickers: [],
showPickerHint: false,
},
} satisfies Meta<Props>;
export function Full(args: Props): JSX.Element {
return (
<StickerPicker {...args} packs={packs} recentStickers={recentStickers} />
);
2022-11-18 00:45:19 +00:00
}
export function PickerHint(args: Props): JSX.Element {
return (
<StickerPicker
{...args}
packs={packs}
recentStickers={recentStickers}
showPickerHint
/>
);
2022-11-18 00:45:19 +00:00
}
export function NoRecentStickers(args: Props): JSX.Element {
return <StickerPicker {...args} packs={packs} />;
2022-11-18 00:45:19 +00:00
}
export function Empty(args: Props): JSX.Element {
return <StickerPicker {...args} />;
2022-11-18 00:45:19 +00:00
}
export function PendingDownload(args: Props): JSX.Element {
const pack = createPack(
{ status: 'pending', stickers: [abeSticker] },
abeSticker
);
return <StickerPicker {...args} packs={[pack]} />;
2022-11-18 00:45:19 +00:00
}
export function Error(args: Props): JSX.Element {
const pack = createPack(
{ status: 'error', stickers: [abeSticker] },
abeSticker
);
return <StickerPicker {...args} packs={[pack]} />;
2022-11-18 00:45:19 +00:00
}
export function NoCover(args: Props): JSX.Element {
const pack = createPack({ status: 'error', stickers: [abeSticker] });
return <StickerPicker {...args} packs={[pack]} />;
2022-11-18 00:45:19 +00:00
}