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

76 lines
1.6 KiB
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button, ButtonSize, ButtonVariant } from './Button';
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/Button',
};
2022-11-18 00:45:19 +00:00
export function KitchenSink(): JSX.Element {
return (
<>
{Object.values(ButtonVariant).map(variant => (
<React.Fragment key={variant}>
{[ButtonSize.Large, ButtonSize.Medium, ButtonSize.Small].map(size => (
<React.Fragment key={size}>
<p>
<Button
onClick={action('onClick')}
size={size}
variant={variant}
>
{variant}
</Button>
</p>
<p>
<Button
disabled
onClick={action('onClick')}
size={size}
variant={variant}
>
{variant}
</Button>
</p>
</React.Fragment>
))}
</React.Fragment>
))}
</>
);
}
2021-04-27 22:35:35 +00:00
2022-06-07 00:48:02 +00:00
KitchenSink.story = {
name: 'Kitchen sink',
};
2022-11-18 00:45:19 +00:00
export function AriaLabel(): JSX.Element {
return (
<Button
aria-label="hello"
className="module-ForwardMessageModal__header--back"
onClick={action('onClick')}
/>
);
}
2022-06-07 00:48:02 +00:00
AriaLabel.story = {
name: 'aria-label',
};
2022-11-18 00:45:19 +00:00
export function CustomStyles(): JSX.Element {
return (
<Button onClick={action('onClick')} style={{ transform: 'rotate(5deg)' }}>
Hello world
</Button>
);
}
2022-06-07 00:48:02 +00:00
CustomStyles.story = {
name: 'Custom styles',
};