import React from 'react';
import { Box, Table, TableCell, TableBody, TableHead, TableRow } from '@mui/material';
import TextField from '@/components/TextField/TextField';
import type { StoryFn, Meta } from '@storybook/react-webpack5';
export default {
title: 'Components/TextField',
component: TextField,
args: {
disabled: false,
size: 'small',
placeholder: 'Please typing...',
helperText: 'Helper Text',
},
argTypes: {
disabled: {
control: { type: 'radio' },
options: [true, false],
description: 'If true, the text field will be disabled.',
table: {
defaultValue: { summary: 'false' },
type: { summary: 'boolean' },
},
},
size: {
control: { type: 'radio' },
options: ['small', 'medium', 'large'],
description: 'The size of the text field.',
table: {
defaultValue: { summary: 'small' },
type: { summary: 'string' },
},
},
placeholder: {
type: 'string',
description: 'The placeholder content.',
table: {
defaultValue: { summary: 'undefined' },
type: { summary: 'string' },
},
},
helperText: {
type: 'string',
description: 'The helper text content, use "error " or "sub text " to display helper text.',
table: {
defaultValue: { summary: 'undefined' },
type: { summary: 'string' },
},
},
},
parameters: {
controls: {
include: ['size', 'disabled', 'helperText', 'placeholder'],
},
docs: {
description: {
component: `The size of the text field.
\n The default value is "small" and can be set to "medium" or "large".`,
},
},
},
decorators: [(Story) => {Story()}],
} as Meta;
const TextFieldSizeWithTableTemplate: StoryFn = (args) => (
Small
Medium
Large
Single line
Multi line
);
export const TextFieldSize = {
render: TextFieldSizeWithTableTemplate,
name: 'Size',
};
const TextFieldSizeTemplate: StoryFn = (args) => (
);
export const TextFieldOnlySize = {
render: TextFieldSizeTemplate,
name: 'Size Only',
parameters: {
chromatic: { disableSnapshot: true },
},
};