signal-desktop/ts/components/ContextMenu.stories.tsx

38 lines
861 B
TypeScript
Raw Normal View History

2022-03-04 21:14:52 +00:00
// Copyright 2021-2022 Signal Messenger, LLC
2021-12-01 02:14:25 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './ContextMenu';
import { ContextMenu } from './ContextMenu';
import enMessages from '../../_locales/en/messages.json';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const story = storiesOf('Components/ContextMenu', module);
const getDefaultProps = (): PropsType<number> => ({
i18n,
menuOptions: [
{
label: '1',
2022-03-04 21:14:52 +00:00
onClick: action('1'),
2021-12-01 02:14:25 +00:00
},
{
label: '2',
2022-03-04 21:14:52 +00:00
onClick: action('2'),
2021-12-01 02:14:25 +00:00
},
{
label: '3',
2022-03-04 21:14:52 +00:00
onClick: action('3'),
2021-12-01 02:14:25 +00:00
},
],
});
story.add('Default', () => {
return <ContextMenu {...getDefaultProps()} />;
});