2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-07-20 23:06:15 +00:00
|
|
|
import type { Meta, Story } from '@storybook/react';
|
|
|
|
import React from 'react';
|
2020-08-21 22:03:25 +00:00
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { PropsType } from './MainHeader';
|
2022-07-20 23:06:15 +00:00
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
2021-10-26 19:15:33 +00:00
|
|
|
import { MainHeader } from './MainHeader';
|
2021-11-08 16:29:54 +00:00
|
|
|
import { ThemeType } from '../types/Util';
|
2022-07-20 23:06:15 +00:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
|
|
|
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
|
2020-08-21 22:03:25 +00:00
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/MainHeader',
|
2022-07-20 23:06:15 +00:00
|
|
|
component: MainHeader,
|
|
|
|
argTypes: {
|
|
|
|
areStoriesEnabled: {
|
|
|
|
defaultValue: false,
|
|
|
|
},
|
|
|
|
avatarPath: {
|
|
|
|
defaultValue: undefined,
|
|
|
|
},
|
|
|
|
hasPendingUpdate: {
|
|
|
|
defaultValue: false,
|
|
|
|
},
|
|
|
|
i18n: {
|
|
|
|
defaultValue: i18n,
|
|
|
|
},
|
|
|
|
name: {
|
|
|
|
defaultValue: undefined,
|
|
|
|
},
|
|
|
|
phoneNumber: {
|
|
|
|
defaultValue: undefined,
|
|
|
|
},
|
|
|
|
showArchivedConversations: { action: true },
|
|
|
|
startComposing: { action: true },
|
|
|
|
startUpdate: { action: true },
|
|
|
|
theme: {
|
|
|
|
defaultValue: ThemeType.light,
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
defaultValue: '',
|
|
|
|
},
|
|
|
|
toggleProfileEditor: { action: true },
|
|
|
|
toggleStoriesView: { action: true },
|
|
|
|
unreadStoriesCount: {
|
|
|
|
defaultValue: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as Meta;
|
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
// eslint-disable-next-line react/function-component-definition
|
2022-07-20 23:06:15 +00:00
|
|
|
const Template: Story<PropsType> = args => <MainHeader {...args} />;
|
|
|
|
|
|
|
|
export const Basic = Template.bind({});
|
|
|
|
Basic.args = {};
|
|
|
|
|
|
|
|
export const Name = Template.bind({});
|
|
|
|
{
|
|
|
|
const { name, title } = getDefaultConversation();
|
|
|
|
Name.args = {
|
|
|
|
name,
|
|
|
|
title,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export const PhoneNumber = Template.bind({});
|
|
|
|
{
|
|
|
|
const { name, e164: phoneNumber } = getDefaultConversation();
|
|
|
|
PhoneNumber.args = {
|
|
|
|
name,
|
|
|
|
phoneNumber,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export const UpdateAvailable = Template.bind({});
|
|
|
|
UpdateAvailable.args = {
|
|
|
|
hasPendingUpdate: true,
|
2022-06-07 00:48:02 +00:00
|
|
|
};
|
2020-08-21 22:03:25 +00:00
|
|
|
|
2022-07-20 23:06:15 +00:00
|
|
|
export const Stories = Template.bind({});
|
|
|
|
Stories.args = {
|
|
|
|
areStoriesEnabled: true,
|
|
|
|
unreadStoriesCount: 6,
|
2022-06-07 00:48:02 +00:00
|
|
|
};
|
2020-08-21 22:03:25 +00:00
|
|
|
|
2022-07-20 23:06:15 +00:00
|
|
|
export const StoriesOverflow = Template.bind({});
|
|
|
|
StoriesOverflow.args = {
|
|
|
|
areStoriesEnabled: true,
|
|
|
|
unreadStoriesCount: 69,
|
2022-06-07 00:48:02 +00:00
|
|
|
};
|