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

91 lines
2.6 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-10-07 21:25:33 -04:00
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingButton';
import { CallingButton, CallingButtonType } from './CallingButton';
2020-11-19 13:11:35 -05:00
import { TooltipPlacement } from './Tooltip';
2021-09-17 20:30:08 -04:00
import { setupI18n } from '../util/setupI18n';
2020-10-07 21:25:33 -04:00
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
2022-06-06 20:48:02 -04:00
export default {
title: 'Components/CallingButton',
component: CallingButton,
argTypes: {
buttonType: {
control: { type: 'select' },
options: Object.values(CallingButtonType),
},
tooltipDirection: {
control: { type: 'select' },
options: Object.values(TooltipPlacement),
},
},
args: {
2023-10-25 06:40:22 -07:00
buttonType: CallingButtonType.RING_ON,
i18n,
onClick: action('on-click'),
onMouseEnter: action('on-mouse-enter'),
onMouseLeave: action('on-mouse-leave'),
tooltipDirection: TooltipPlacement.Bottom,
},
} satisfies Meta<PropsType>;
export function KitchenSink(args: PropsType): JSX.Element {
return (
<>
{Object.values(CallingButtonType).map(buttonType => (
<CallingButton key={buttonType} {...args} buttonType={buttonType} />
))}
</>
);
2022-11-17 16:45:19 -08:00
}
2020-10-07 21:25:33 -04:00
export function AudioOn(args: PropsType): JSX.Element {
return <CallingButton {...args} buttonType={CallingButtonType.AUDIO_ON} />;
2022-11-17 16:45:19 -08:00
}
2020-10-07 21:25:33 -04:00
export function AudioOff(args: PropsType): JSX.Element {
return <CallingButton {...args} buttonType={CallingButtonType.AUDIO_OFF} />;
2022-11-17 16:45:19 -08:00
}
2020-10-07 21:25:33 -04:00
export function AudioDisabled(args: PropsType): JSX.Element {
return (
<CallingButton {...args} buttonType={CallingButtonType.AUDIO_DISABLED} />
);
2022-11-17 16:45:19 -08:00
}
export function VideoOn(args: PropsType): JSX.Element {
return <CallingButton {...args} buttonType={CallingButtonType.VIDEO_ON} />;
2022-11-17 16:45:19 -08:00
}
2020-10-07 21:25:33 -04:00
export function VideoOff(args: PropsType): JSX.Element {
return <CallingButton {...args} buttonType={CallingButtonType.VIDEO_OFF} />;
2022-11-17 16:45:19 -08:00
}
2020-10-07 21:25:33 -04:00
export function VideoDisabled(args: PropsType): JSX.Element {
return (
<CallingButton {...args} buttonType={CallingButtonType.VIDEO_DISABLED} />
);
2022-11-17 16:45:19 -08:00
}
export function TooltipRight(args: PropsType): JSX.Element {
return <CallingButton {...args} tooltipDirection={TooltipPlacement.Right} />;
2022-11-17 16:45:19 -08:00
}
2022-06-06 20:48:02 -04:00
export function PresentingOn(args: PropsType): JSX.Element {
return (
<CallingButton {...args} buttonType={CallingButtonType.PRESENTING_ON} />
);
2022-11-17 16:45:19 -08:00
}
export function PresentingOff(args: PropsType): JSX.Element {
return (
<CallingButton {...args} buttonType={CallingButtonType.PRESENTING_OFF} />
);
2022-11-17 16:45:19 -08:00
}