Storybook: Add controls to InlineLabel story (#54604)

This commit is contained in:
Tima Gixe 2022-09-06 17:18:38 +03:00 committed by GitHub
parent 05c16d1da3
commit ce1221cd59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { InlineLabel } from './InlineLabel';
import { InlineLabel, Props } from './InlineLabel';
import mdx from './InlineLabel.mdx';
const meta: ComponentMeta<typeof InlineLabel> = {
@ -11,19 +11,44 @@ const meta: ComponentMeta<typeof InlineLabel> = {
docs: {
page: mdx,
},
controls: {
exclude: ['as'],
},
},
argTypes: {
children: {
control: 'text',
},
tooltip: {
control: 'text',
},
width: {
control: 'text',
},
},
};
export const basic = () => {
return <InlineLabel width="auto">Simple label</InlineLabel>;
export const Basic = (args: Props) => <InlineLabel {...args} />;
Basic.args = {
children: 'Simple text',
width: 'auto',
tooltip: undefined,
transparent: false,
interactive: false,
};
export const withTooltip = () => {
return (
<InlineLabel width="auto" tooltip="Tooltip content">
Simple label
</InlineLabel>
);
Basic.parameters = {
controls: {
exclude: ['as', 'tooltip', 'interactive'],
},
};
export const WithTooltip = (args: Props) => <InlineLabel {...args} />;
WithTooltip.args = {
...Basic.args,
tooltip: 'Info text',
};
export default meta;