2021-12-01 02:14:25 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
import type { Meta, StoryFn } from '@storybook/react';
|
2021-12-01 02:14:25 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
import { action } from '@storybook/addon-actions';
|
2021-12-01 02:14:25 +00:00
|
|
|
import type { PropsType } from './MediaEditor';
|
|
|
|
import { MediaEditor } from './MediaEditor';
|
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
import { setupI18n } from '../util/setupI18n';
|
|
|
|
import { Stickers, installedPacks } from '../test-both/helpers/getStickerPacks';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
const IMAGE_1 = '/fixtures/nathan-anderson-316188-unsplash.jpg';
|
|
|
|
const IMAGE_2 = '/fixtures/tina-rolf-269345-unsplash.jpg';
|
|
|
|
const IMAGE_3 = '/fixtures/kitten-4-112-112.jpg';
|
|
|
|
const IMAGE_4 = '/fixtures/snow.jpg';
|
|
|
|
|
2023-09-14 17:04:48 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/MediaEditor',
|
|
|
|
component: MediaEditor,
|
2023-10-11 19:06:43 +00:00
|
|
|
args: {
|
|
|
|
getPreferredBadge: () => undefined,
|
|
|
|
i18n,
|
|
|
|
imageToBlurHash: input => Promise.resolve(input.toString()),
|
|
|
|
imageSrc: IMAGE_2,
|
|
|
|
installedPacks,
|
|
|
|
isFormattingEnabled: true,
|
|
|
|
isSending: false,
|
|
|
|
onClose: action('onClose'),
|
|
|
|
onDone: action('onDone'),
|
|
|
|
onPickEmoji: action('onPickEmoji'),
|
|
|
|
onTextTooLong: action('onTextTooLong'),
|
|
|
|
platform: 'darwin',
|
|
|
|
recentStickers: [Stickers.wide, Stickers.tall, Stickers.abe],
|
|
|
|
skinTone: 0,
|
2023-09-14 17:04:48 +00:00
|
|
|
},
|
2023-10-11 19:06:43 +00:00
|
|
|
} satisfies Meta<PropsType>;
|
2021-12-01 02:14:25 +00:00
|
|
|
|
2023-09-14 17:04:48 +00:00
|
|
|
// eslint-disable-next-line react/function-component-definition
|
2023-10-11 19:06:43 +00:00
|
|
|
const Template: StoryFn<PropsType> = args => <MediaEditor {...args} />;
|
2021-12-01 02:14:25 +00:00
|
|
|
|
2023-09-14 17:04:48 +00:00
|
|
|
export const ExtraLarge = Template.bind({});
|
2021-12-01 02:14:25 +00:00
|
|
|
|
2023-09-14 17:04:48 +00:00
|
|
|
export const Large = Template.bind({});
|
|
|
|
Large.args = {
|
|
|
|
imageSrc: IMAGE_1,
|
|
|
|
};
|
2021-12-01 02:14:25 +00:00
|
|
|
|
2023-09-14 17:04:48 +00:00
|
|
|
export const Smol = Template.bind({});
|
|
|
|
Smol.args = {
|
|
|
|
imageSrc: IMAGE_3,
|
|
|
|
};
|
2022-10-04 23:17:15 +00:00
|
|
|
|
2023-09-14 17:04:48 +00:00
|
|
|
export const Portrait = Template.bind({});
|
|
|
|
Portrait.args = {
|
|
|
|
imageSrc: IMAGE_4,
|
|
|
|
};
|
2022-11-02 00:36:16 +00:00
|
|
|
|
2023-09-14 17:04:48 +00:00
|
|
|
export const Sending = Template.bind({});
|
|
|
|
Sending.args = {
|
|
|
|
isSending: true,
|
|
|
|
};
|