2021-01-29 21:19:24 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { Props } from './ConversationDetailsIcon';
|
|
|
|
import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon';
|
2021-01-29 21:19:24 +00:00
|
|
|
|
|
|
|
const story = storiesOf(
|
|
|
|
'Components/Conversation/ConversationDetails/ConversationDetailIcon',
|
|
|
|
module
|
|
|
|
);
|
|
|
|
|
|
|
|
const createProps = (overrideProps: Partial<Props>): Props => ({
|
|
|
|
ariaLabel: overrideProps.ariaLabel || '',
|
2021-10-20 23:46:41 +00:00
|
|
|
icon: overrideProps.icon || IconType.timer,
|
2021-01-29 21:19:24 +00:00
|
|
|
onClick: overrideProps.onClick,
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('All', () => {
|
2021-10-20 23:46:41 +00:00
|
|
|
const icons = Object.values(IconType);
|
2021-01-29 21:19:24 +00:00
|
|
|
|
|
|
|
return icons.map(icon => (
|
|
|
|
<ConversationDetailsIcon {...createProps({ icon })} />
|
|
|
|
));
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('Clickable Icons', () => {
|
2021-10-20 23:46:41 +00:00
|
|
|
const icons = [
|
|
|
|
IconType.timer,
|
|
|
|
IconType.trash,
|
|
|
|
IconType.invites,
|
|
|
|
IconType.block,
|
|
|
|
IconType.leave,
|
|
|
|
IconType.down,
|
|
|
|
];
|
2021-01-29 21:19:24 +00:00
|
|
|
|
|
|
|
const onClick = action('onClick');
|
|
|
|
|
|
|
|
return icons.map(icon => (
|
|
|
|
<ConversationDetailsIcon {...createProps({ icon, onClick })} />
|
|
|
|
));
|
|
|
|
});
|