p5.js-web-editor/client/common/Button.stories.jsx

53 lines
1.5 KiB
React
Raw Normal View History

2020-01-19 18:04:44 +01:00
import React from 'react';
import { action } from '@storybook/addon-actions';
import { boolean, text } from '@storybook/addon-knobs';
2020-04-19 17:12:55 +02:00
import Button from './Button';
2020-01-19 18:04:44 +01:00
export default {
2020-04-19 17:12:55 +02:00
title: 'Common/Button',
2020-01-19 18:04:44 +01:00
component: Button
};
export const AllFeatures = () => (
<Button
disabled={boolean('disabled', false)}
type="submit"
label={text('label', 'submit')}
>
{text('children', 'this is the button')}
</Button>
);
export const SubmitButton = () => (
<Button type="submit" label="submit">This is a submit button</Button>
);
2020-05-03 11:54:57 +02:00
export const DefaultTypeButton = () => <Button label="login" onClick={action('onClick')}>Log In</Button>;
2020-01-19 18:04:44 +01:00
export const DisabledButton = () => <Button disabled label="login" onClick={action('onClick')}>Log In</Button>;
2020-04-19 17:12:55 +02:00
export const AnchorButton = () => (
<Button href="http://p5js.org" label="submit">Actually an anchor</Button>
);
export const ReactRouterLink = () => (
<Button to="./somewhere" label="submit">Actually a Link</Button>
);
export const ButtonWithIconBefore = () => (
<Button iconBeforeName={Button.iconNames.Github}>Create</Button>
);
export const ButtonWithIconAfter = () => (
<Button iconAfterName={Button.iconNames.Github}>Create</Button>
);
export const InlineButtonWithIconAfter = () => (
<Button kind={Button.kinds.inline} iconAfterName={Button.iconNames.SortArrowDown}>File name</Button>
);
export const InlineIconOnlyButton = () => (
<Button kind={Button.kinds.inline} iconAfterName={Button.iconNames.Plus} label="Add to collection" />
);