mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-02-06 05:40:09 +00:00
112 lines
2.6 KiB
Text
112 lines
2.6 KiB
Text
import { Meta, Story, Props, Canvas } from '@storybook/addon-docs/blocks'
|
|
import { config, withDesign } from 'storybook-addon-designs'
|
|
|
|
import ButtonIcon from '@baserow/modules/core/components/ButtonIcon'
|
|
|
|
<Meta
|
|
title="Baserow/Buttons/Icon"
|
|
component={ButtonIcon}
|
|
decorators={[withDesign]}
|
|
argTypes={{
|
|
type: {
|
|
control: {
|
|
type: 'select',
|
|
options: ['primary', 'secondary'],
|
|
},
|
|
defaultValue: 'primary',
|
|
},
|
|
tag: {
|
|
control: {
|
|
type: 'radio',
|
|
options: ['a', 'button'],
|
|
},
|
|
defaultValue: 'button',
|
|
},
|
|
size: {
|
|
control: {
|
|
type: 'select',
|
|
options: ['regular', 'small'],
|
|
},
|
|
defaultValue: 'regular',
|
|
},
|
|
icon: {
|
|
defaultValue: 'iconoir-list',
|
|
},
|
|
loading: {
|
|
control: {
|
|
type: 'boolean',
|
|
options: [true, false],
|
|
},
|
|
defaultValue: false,
|
|
},
|
|
disabled: {
|
|
control: {
|
|
type: 'boolean',
|
|
options: [true, false],
|
|
},
|
|
defaultValue: false,
|
|
},
|
|
active: {
|
|
control: {
|
|
type: 'boolean',
|
|
options: [true, false],
|
|
},
|
|
defaultValue: false,
|
|
},
|
|
rel: {
|
|
control: {
|
|
type: 'text',
|
|
},
|
|
defaultValue: null,
|
|
},
|
|
href: {
|
|
control: {
|
|
type: 'text',
|
|
},
|
|
defaultValue: '',
|
|
},
|
|
target: {
|
|
control: {
|
|
type: 'select',
|
|
options: ['_blank', '_self', '_parent', '_top'],
|
|
},
|
|
defaultValue: null,
|
|
},
|
|
}}
|
|
/>
|
|
|
|
# Button Icon
|
|
|
|
The button icon component is a button that only contains an icon.
|
|
|
|
export const Template = (args, { argTypes }) => ({
|
|
components: { ButtonIcon },
|
|
props: Object.keys(argTypes),
|
|
template: `<ButtonIcon v-bind="$props"></ButtonIcon>`,
|
|
})
|
|
|
|
export const designConfig = {
|
|
type: 'figma',
|
|
url: 'https://www.figma.com/file/W7R2rQW7ohsZMeHRfEcPFW/Design-Library?type=design&node-id=1-85&mode=design&t=ZFKwI59cTYQROI8S-0',
|
|
}
|
|
|
|
<Canvas>
|
|
<Story
|
|
name="Default"
|
|
parameters={{
|
|
design: config(designConfig),
|
|
}}
|
|
>
|
|
{Template.bind({})}
|
|
</Story>
|
|
</Canvas>
|
|
|
|
## Example
|
|
|
|
```javascript
|
|
<ButtonIcon icon="iconoir-list"></ButtonIcon>
|
|
```
|
|
|
|
## Props
|
|
|
|
<Props of={ButtonIcon} />
|