import React, { useState } from 'react'; import { Story, Meta } from '@storybook/react'; import TextFieldValidated, { ITextFieldValidatedProps, } from './TextFieldValidated'; export default { title: 'Controls/TextFieldValidated', component: TextFieldValidated, parameters: { docs: { description: { component: TextFieldValidated.peek.description, }, }, }, } as Meta; const style = { marginBottom: '10px', }; export const Basic: Story = (args) => { return ; }; export const Debounced: Story = (args) => { const [value, setValue] = useState(''); return (
setValue(value)} Error={value === 'foo' ? null : 'Please enter "foo"'} />
); }; export const ErrorTypes: Story = (args) => { const [value, setValue] = useState(''); return (
{}} Error={'This is an error'} /> {}} Error={null} Info={'This is an info'} /> {}} Error={null} Success={{ message: 'This is a Success', }} /> {}} Error={null} Success={{ message: 'This is a disappearing Success', disappearing: true, }} />
); };