2021-08-17 21:45:18 +00:00
|
|
|
// Copyright 2020-2021 Signal Messenger, LLC
|
2020-11-17 15:07:53 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { boolean, number } from '@storybook/addon-knobs';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
|
|
|
|
i18n,
|
|
|
|
isGroupCall: boolean('isGroupCall', Boolean(overrideProps.isGroupCall)),
|
2020-11-23 21:37:39 +00:00
|
|
|
message: overrideProps.message,
|
2020-11-25 18:16:51 +00:00
|
|
|
participantCount: number(
|
|
|
|
'participantCount',
|
|
|
|
overrideProps.participantCount || 0
|
2020-11-17 15:07:53 +00:00
|
|
|
),
|
2020-11-20 19:39:50 +00:00
|
|
|
showParticipantsList: boolean(
|
|
|
|
'showParticipantsList',
|
|
|
|
Boolean(overrideProps.showParticipantsList)
|
|
|
|
),
|
2020-11-23 21:37:39 +00:00
|
|
|
title: overrideProps.title || 'With Someone',
|
2020-11-17 15:07:53 +00:00
|
|
|
toggleParticipants: () => action('toggle-participants'),
|
|
|
|
togglePip: () => action('toggle-pip'),
|
|
|
|
toggleSettings: () => action('toggle-settings'),
|
|
|
|
});
|
|
|
|
|
|
|
|
const story = storiesOf('Components/CallingHeader', module);
|
|
|
|
|
|
|
|
story.add('Default', () => <CallingHeader {...createProps()} />);
|
|
|
|
|
2021-08-17 21:45:18 +00:00
|
|
|
story.add('Lobby style', () => (
|
|
|
|
<CallingHeader
|
|
|
|
{...createProps()}
|
|
|
|
title={undefined}
|
|
|
|
togglePip={undefined}
|
|
|
|
onCancel={action('onClose')}
|
|
|
|
/>
|
2020-11-17 15:07:53 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
story.add('With Participants', () => (
|
|
|
|
<CallingHeader
|
|
|
|
{...createProps({
|
|
|
|
isGroupCall: true,
|
2020-11-25 18:16:51 +00:00
|
|
|
participantCount: 10,
|
2020-11-17 15:07:53 +00:00
|
|
|
})}
|
|
|
|
/>
|
|
|
|
));
|
|
|
|
|
2020-11-20 19:39:50 +00:00
|
|
|
story.add('With Participants (shown)', () => (
|
|
|
|
<CallingHeader
|
|
|
|
{...createProps({
|
|
|
|
isGroupCall: true,
|
2020-11-25 18:16:51 +00:00
|
|
|
participantCount: 10,
|
2020-11-20 19:39:50 +00:00
|
|
|
showParticipantsList: true,
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
));
|
|
|
|
|
2020-11-17 15:07:53 +00:00
|
|
|
story.add('Long Title', () => (
|
|
|
|
<CallingHeader
|
|
|
|
{...createProps({
|
2020-11-23 21:37:39 +00:00
|
|
|
title:
|
2020-11-17 15:07:53 +00:00
|
|
|
'What do I got to, what do I got to do to wake you up? To shake you up, to break the structure up?',
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
));
|
2020-11-23 21:37:39 +00:00
|
|
|
|
|
|
|
story.add('Title with message', () => (
|
|
|
|
<CallingHeader
|
|
|
|
{...createProps({
|
|
|
|
title: 'Hello world',
|
|
|
|
message: 'Goodbye earth',
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
));
|