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

79 lines
2 KiB
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2020 Signal Messenger, LLC
2020-11-17 15:07:53 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingHeader';
import { CallingHeader } from './CallingHeader';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../util/setupI18n';
2020-11-17 15:07:53 +00:00
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/CallingHeader',
component: CallingHeader,
argTypes: {
isGroupCall: { control: { type: 'boolean' } },
participantCount: { control: { type: 'number' } },
title: { control: { type: 'text' } },
},
args: {
i18n,
isGroupCall: false,
message: '',
participantCount: 0,
showParticipantsList: false,
title: 'With Someone',
toggleParticipants: action('toggle-participants'),
togglePip: action('toggle-pip'),
toggleSettings: action('toggle-settings'),
},
} satisfies Meta<PropsType>;
2020-11-17 15:07:53 +00:00
export function Default(args: PropsType): JSX.Element {
return <CallingHeader {...args} />;
2022-11-18 00:45:19 +00:00
}
2020-11-17 15:07:53 +00:00
export function LobbyStyle(args: PropsType): JSX.Element {
2022-11-18 00:45:19 +00:00
return (
<CallingHeader
{...args}
2022-11-18 00:45:19 +00:00
title={undefined}
togglePip={undefined}
onCancel={action('onClose')}
/>
);
}
2020-11-17 15:07:53 +00:00
export function WithParticipants(args: PropsType): JSX.Element {
return <CallingHeader {...args} isGroupCall participantCount={10} />;
2022-11-18 00:45:19 +00:00
}
2020-11-17 15:07:53 +00:00
export function WithParticipantsShown(args: PropsType): JSX.Element {
2022-11-18 00:45:19 +00:00
return (
<CallingHeader
{...args}
isGroupCall
participantCount={10}
showParticipantsList
2022-11-18 00:45:19 +00:00
/>
);
}
2022-06-07 00:48:02 +00:00
export function LongTitle(args: PropsType): JSX.Element {
2022-11-18 00:45:19 +00:00
return (
<CallingHeader
{...args}
title="What do I got to, what do I got to do to wake you up? To shake you up, to break the structure up?"
2022-11-18 00:45:19 +00:00
/>
);
}
2020-11-23 21:37:39 +00:00
export function TitleWithMessage(args: PropsType): JSX.Element {
2022-11-18 00:45:19 +00:00
return (
<CallingHeader {...args} title="Hello world" message="Goodbye earth" />
2022-11-18 00:45:19 +00:00
);
}