2021-02-23 19:28:48 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
2021-04-30 22:58:57 +00:00
|
|
|
import { Button, ButtonSize, ButtonVariant } from './Button';
|
2021-02-23 19:28:48 +00:00
|
|
|
|
|
|
|
const story = storiesOf('Components/Button', module);
|
|
|
|
|
|
|
|
story.add('Kitchen sink', () => (
|
|
|
|
<>
|
2021-08-26 20:51:55 +00:00
|
|
|
{[
|
|
|
|
ButtonVariant.Primary,
|
|
|
|
ButtonVariant.Secondary,
|
|
|
|
ButtonVariant.SecondaryAffirmative,
|
|
|
|
ButtonVariant.SecondaryDestructive,
|
|
|
|
ButtonVariant.Destructive,
|
|
|
|
ButtonVariant.Calling,
|
|
|
|
ButtonVariant.SystemMessage,
|
|
|
|
].map(variant => (
|
|
|
|
<React.Fragment key={variant}>
|
|
|
|
{[ButtonSize.Medium, ButtonSize.Small].map(size => (
|
|
|
|
<React.Fragment key={size}>
|
2021-04-30 22:58:57 +00:00
|
|
|
<p>
|
|
|
|
<Button onClick={action('onClick')} size={size} variant={variant}>
|
2021-08-26 20:51:55 +00:00
|
|
|
{variant}
|
2021-04-30 22:58:57 +00:00
|
|
|
</Button>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<Button
|
|
|
|
disabled
|
|
|
|
onClick={action('onClick')}
|
|
|
|
size={size}
|
|
|
|
variant={variant}
|
|
|
|
>
|
2021-08-26 20:51:55 +00:00
|
|
|
{variant}
|
2021-04-30 22:58:57 +00:00
|
|
|
</Button>
|
|
|
|
</p>
|
|
|
|
</React.Fragment>
|
|
|
|
))}
|
2021-04-06 22:14:18 +00:00
|
|
|
</React.Fragment>
|
|
|
|
))}
|
2021-02-23 19:28:48 +00:00
|
|
|
</>
|
|
|
|
));
|
2021-04-27 22:35:35 +00:00
|
|
|
|
|
|
|
story.add('aria-label', () => (
|
|
|
|
<Button
|
|
|
|
aria-label="hello"
|
|
|
|
className="module-ForwardMessageModal__header--back"
|
|
|
|
onClick={action('onClick')}
|
|
|
|
/>
|
|
|
|
));
|
2021-08-17 21:45:18 +00:00
|
|
|
|
|
|
|
story.add('Custom styles', () => (
|
|
|
|
<Button onClick={action('onClick')} style={{ transform: 'rotate(5deg)' }}>
|
|
|
|
Hello world
|
|
|
|
</Button>
|
|
|
|
));
|