signal-desktop/ts/components/conversation/conversation-details/PanelSection.stories.tsx
2022-11-17 16:45:19 -08:00

70 lines
1.8 KiB
TypeScript

// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import { boolean, text } from '@storybook/addon-knobs';
import type { Props } from './PanelSection';
import { PanelSection } from './PanelSection';
import { PanelRow } from './PanelRow';
export default {
title: 'Components/Conversation/ConversationDetails/PanelSection',
};
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
title: text('label', overrideProps.title || ''),
centerTitle: boolean('centerTitle', overrideProps.centerTitle || false),
actions: boolean('with action', overrideProps.actions !== undefined) ? (
<button onClick={action('actions onClick')} type="button">
action
</button>
) : null,
});
export function Basic(): JSX.Element {
const props = createProps({
title: 'panel section header',
});
return <PanelSection {...props} />;
}
export function Centered(): JSX.Element {
const props = createProps({
title: 'this is a panel row',
centerTitle: true,
});
return <PanelSection {...props} />;
}
export function WithActions(): JSX.Element {
const props = createProps({
title: 'this is a panel row',
actions: (
<button onClick={action('actions onClick')} type="button">
action
</button>
),
});
return <PanelSection {...props} />;
}
export function WithContent(): JSX.Element {
const props = createProps({
title: 'this is a panel row',
});
return (
<PanelSection {...props}>
<PanelRow label="this is panel row one" />
<PanelRow label="this is panel row two" />
<PanelRow label="this is panel row three" />
<PanelRow label="this is panel row four" />
</PanelSection>
);
}