signal-desktop/ts/components/conversation/conversation-details/ConversationDetailsIcon.stories.tsx

53 lines
1.2 KiB
TypeScript
Raw Normal View History

// 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 { Props } from './ConversationDetailsIcon';
import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon';
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/Conversation/ConversationDetails/ConversationDetailIcon',
};
const createProps = (overrideProps: Partial<Props>): Props => ({
ariaLabel: overrideProps.ariaLabel || '',
icon: overrideProps.icon || IconType.timer,
onClick: overrideProps.onClick,
});
2022-11-18 00:45:19 +00:00
export function All(): JSX.Element {
const icons = Object.values(IconType);
2022-06-07 00:48:02 +00:00
return (
<>
{icons.map(icon => (
<ConversationDetailsIcon {...createProps({ icon })} />
))}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-11-18 00:45:19 +00:00
export function ClickableIcons(): JSX.Element {
const icons = [
IconType.timer,
IconType.trash,
IconType.invites,
IconType.block,
IconType.leave,
IconType.down,
];
const onClick = action('onClick');
2022-06-07 00:48:02 +00:00
return (
<>
{icons.map(icon => (
<ConversationDetailsIcon {...createProps({ icon, onClick })} />
))}
</>
);
2022-11-18 00:45:19 +00:00
}