Files
Automata/packages/design-system/src/components/N8nButton/Button.stories.ts
Csaba Tuncsik ec2c55211c refactor(design-system): merge n8n square button into n8n button (#4075)
* feat(design-system): button as square shape

* refactor(editor-ui): drop n8n-square-button in favor of n8n-button

* refactor(design-system): remove obsolete n8n-square-button

* fix(design-system): icon only square button icon position

* fix(design-system): icon only square button icon position

* chore(design-system): update button test snapshot

* fix(design-system): overriding default square button styles

* fix(editor-ui): using tertiary button variant in survey without local style overrides

* refactor(design-system): simplifying and partially merging icon-button and button

* fix(design-system): remove unused prop from icon-button

* fix(design-system): square button should have the old dimensions

* fix(design-system): square button update test snapshots
2022-09-15 11:41:12 +02:00

174 lines
4.7 KiB
TypeScript

/* tslint:disable:variable-name */
import N8nButton from './Button.vue';
import { action } from '@storybook/addon-actions';
import { StoryFn } from "@storybook/vue";
export default {
title: 'Atoms/Button',
component: N8nButton,
argTypes: {
type: {
control: 'select',
options: ['primary', 'secondary', 'tertiary', 'success', 'warning', 'danger'],
},
size: {
control: {
type: 'select',
options: ['mini', 'small', 'medium', 'large', 'xlarge'],
},
},
float: {
type: 'select',
options: ['left', 'right'],
},
},
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/DxLbnIyMK8X0uLkUguFV4n/n8n-design-system_v1?node-id=5%3A1147',
},
},
};
const methods = {
onClick: action('click'),
};
const Template: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nButton,
},
template: '<n8n-button v-bind="$props" @click="onClick" />',
methods,
});
export const Button = Template.bind({});
Button.args = {
label: 'Button',
};
const AllSizesTemplate: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nButton,
},
template: `<div>
<n8n-button v-bind="$props" size="large" @click="onClick" />
<n8n-button v-bind="$props" size="medium" @click="onClick" />
<n8n-button v-bind="$props" size="small" @click="onClick" />
<n8n-button v-bind="$props" :loading="true" @click="onClick" />
<n8n-button v-bind="$props" :disabled="true" @click="onClick" />
</div>`,
methods,
});
const AllColorsTemplate: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nButton,
},
template: `<div>
<n8n-button v-bind="$props" type="primary" @click="onClick" />
<n8n-button v-bind="$props" type="secondary" @click="onClick" />
<n8n-button v-bind="$props" type="tertiary" @click="onClick" />
<n8n-button v-bind="$props" type="success" @click="onClick" />
<n8n-button v-bind="$props" type="warning" @click="onClick" />
<n8n-button v-bind="$props" type="danger" @click="onClick" />
</div>`,
methods,
});
const AllColorsAndSizesTemplate: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nButton,
},
template: `<div>
<n8n-button v-bind="$props" size="large" type="primary" @click="onClick" />
<n8n-button v-bind="$props" size="large" type="secondary" @click="onClick" />
<n8n-button v-bind="$props" size="large" type="tertiary" @click="onClick" />
<n8n-button v-bind="$props" size="large" type="success" @click="onClick" />
<n8n-button v-bind="$props" size="large" type="warning" @click="onClick" />
<n8n-button v-bind="$props" size="large" type="danger" @click="onClick" />
<br/>
<br/>
<n8n-button v-bind="$props" size="medium" type="primary" @click="onClick" />
<n8n-button v-bind="$props" size="medium" type="secondary" @click="onClick" />
<n8n-button v-bind="$props" size="medium" type="tertiary" @click="onClick" />
<n8n-button v-bind="$props" size="medium" type="success" @click="onClick" />
<n8n-button v-bind="$props" size="medium" type="warning" @click="onClick" />
<n8n-button v-bind="$props" size="medium" type="danger" @click="onClick" />
<br/>
<br/>
<n8n-button v-bind="$props" size="small" type="primary" @click="onClick" />
<n8n-button v-bind="$props" size="small" type="secondary" @click="onClick" />
<n8n-button v-bind="$props" size="small" type="tertiary" @click="onClick" />
<n8n-button v-bind="$props" size="small" type="success" @click="onClick" />
<n8n-button v-bind="$props" size="small" type="warning" @click="onClick" />
<n8n-button v-bind="$props" size="small" type="danger" @click="onClick" />
</div>`,
methods,
});
export const Primary = AllSizesTemplate.bind({});
Primary.args = {
type: 'primary',
label: 'Button',
};
export const Secondary = AllSizesTemplate.bind({});
Secondary.args = {
type: 'secondary',
label: 'Button',
};
export const Tertiary = AllSizesTemplate.bind({});
Tertiary.args = {
type: 'tertiary',
label: 'Button',
};
export const Success = AllSizesTemplate.bind({});
Success.args = {
type: 'success',
label: 'Button',
};
export const Warning = AllSizesTemplate.bind({});
Warning.args = {
type: 'warning',
label: 'Button',
};
export const Danger = AllSizesTemplate.bind({});
Danger.args = {
type: 'danger',
label: 'Button',
};
export const Outline = AllColorsAndSizesTemplate.bind({});
Outline.args = {
outline: true,
label: 'Button',
};
export const Text = AllColorsAndSizesTemplate.bind({});
Text.args = {
text: true,
label: 'Button',
};
export const WithIcon = AllSizesTemplate.bind({});
WithIcon.args = {
label: 'Button',
icon: 'plus-circle',
};
export const Square = AllColorsAndSizesTemplate.bind({});
Square.args = {
label: '48',
square: true,
};