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

72 lines
1.8 KiB
TypeScript
Raw Normal View History

2023-01-03 11:55:46 -08:00
// Copyright 2020 Signal Messenger, LLC
2020-10-30 15:34:04 -05:00
// SPDX-License-Identifier: AGPL-3.0-only
2020-05-27 17:37:06 -04:00
import * as React from 'react';
import { text } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
2020-09-14 12:51:27 -07:00
import type { Props as MessageRequestActionsProps } from './MessageRequestActions';
import { MessageRequestActions } from './MessageRequestActions';
2021-09-17 20:30:08 -04:00
import { setupI18n } from '../../util/setupI18n';
2020-05-27 17:37:06 -04:00
import enMessages from '../../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const getBaseProps = (isGroup = false): MessageRequestActionsProps => ({
2022-12-06 14:03:09 -05:00
conversationId: '123',
2020-05-27 17:37:06 -04:00
i18n,
conversationType: isGroup ? 'group' : 'direct',
firstName: text('firstName', 'Cayce'),
2020-07-23 18:35:32 -07:00
title: isGroup
? text('title', 'NYC Rock Climbers')
: text('title', 'Cayce Bollard'),
2022-12-06 14:03:09 -05:00
acceptConversation: action('acceptConversation'),
blockAndReportSpam: action('blockAndReportSpam'),
blockConversation: action('blockConversation'),
deleteConversation: action('deleteConversation'),
2020-05-27 17:37:06 -04:00
});
2022-06-06 20:48:02 -04:00
export default {
title: 'Components/Conversation/MessageRequestActions',
};
2022-11-17 16:45:19 -08:00
export function Direct(): JSX.Element {
2022-06-06 20:48:02 -04:00
return (
<div style={{ width: '480px' }}>
<MessageRequestActions {...getBaseProps()} />
</div>
);
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 DirectBlocked(): JSX.Element {
2022-06-06 20:48:02 -04:00
return (
<div style={{ width: '480px' }}>
<MessageRequestActions {...getBaseProps()} isBlocked />
</div>
);
2022-11-17 16:45:19 -08:00
}
2022-06-06 20:48:02 -04:00
DirectBlocked.story = {
name: 'Direct (Blocked)',
};
2022-11-17 16:45:19 -08:00
export function Group(): JSX.Element {
2022-06-06 20:48:02 -04:00
return (
<div style={{ width: '480px' }}>
<MessageRequestActions {...getBaseProps(true)} />
</div>
);
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 GroupBlocked(): JSX.Element {
2022-06-06 20:48:02 -04:00
return (
<div style={{ width: '480px' }}>
<MessageRequestActions {...getBaseProps(true)} isBlocked />
</div>
);
2022-11-17 16:45:19 -08:00
}
2022-06-06 20:48:02 -04:00
GroupBlocked.story = {
name: 'Group (Blocked)',
};