-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm.stories.tsx
More file actions
37 lines (30 loc) · 1007 Bytes
/
Form.stories.tsx
File metadata and controls
37 lines (30 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { string } from 'yup';
import { FormikInputProps } from '../Input/FormikInput';
import Form from './Form';
import { FormField } from './Form.d';
export default {
title: 'Form',
component: Form,
} as ComponentMeta<typeof Form>;
const Template: ComponentStory<typeof Form> = (args) => <Form {...args} />;
const FullName: FormField<string, FormikInputProps> = {
name: 'fullName',
type: 'text',
validation: string().required('Full Name is required').nullable(),
componentProps: { placeholder: 'Full Name', name: 'fullName' },
row: 2,
};
const LastName: FormField<string, FormikInputProps> = {
name: 'lastName',
type: 'text',
validation: string().required('Last Name is required').nullable(),
componentProps: { placeholder: 'Last Name', name: 'lastName' },
row: 1,
};
export const Basic = Template.bind({});
Basic.args = {
fields: [FullName, LastName],
handleSubmit: console.log,
className: 'w-48',
};