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

39 lines
837 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 { 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);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/ContextMenu',
};
2021-12-01 02:14:25 +00:00
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
},
],
});
2022-11-18 00:45:19 +00:00
export function Default(): JSX.Element {
return <ContextMenu {...getDefaultProps()}>Menu</ContextMenu>;
2022-11-18 00:45:19 +00:00
}