FieldValidationMessage: update story from knobs to controls (#32020)
This commit is contained in:
@@ -1,13 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { text } from '@storybook/addon-knobs';
|
import { Story } from '@storybook/react';
|
||||||
import { FieldValidationMessage } from './FieldValidationMessage';
|
import { FieldValidationMessage, FieldValidationMessageProps } from './FieldValidationMessage';
|
||||||
import mdx from './FieldValidationMessage.mdx';
|
import mdx from './FieldValidationMessage.mdx';
|
||||||
|
import { NOOP_CONTROL } from '../../utils/storybook/noopControl';
|
||||||
const getKnobs = () => {
|
|
||||||
return {
|
|
||||||
message: text('message', 'Invalid input message'),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Forms/FieldValidationMessage',
|
title: 'Forms/FieldValidationMessage',
|
||||||
@@ -16,17 +11,20 @@ export default {
|
|||||||
docs: {
|
docs: {
|
||||||
page: mdx,
|
page: mdx,
|
||||||
},
|
},
|
||||||
|
knobs: {
|
||||||
|
disable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
args: {
|
||||||
|
horizontal: false,
|
||||||
|
children: 'Invalid input message',
|
||||||
|
},
|
||||||
|
argTypes: {
|
||||||
|
children: { name: 'message' },
|
||||||
|
className: NOOP_CONTROL,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const vertical = () => {
|
export const Basic: Story<FieldValidationMessageProps> = (args) => {
|
||||||
const { message } = getKnobs();
|
return <FieldValidationMessage horizontal={args.horizontal}>{args.children}</FieldValidationMessage>;
|
||||||
|
|
||||||
return <FieldValidationMessage>{message}</FieldValidationMessage>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const horizontal = () => {
|
|
||||||
const { message } = getKnobs();
|
|
||||||
|
|
||||||
return <FieldValidationMessage horizontal>{message}</FieldValidationMessage>;
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user