import { StoryObj, Meta } from '@storybook/react'; import FileDropzone from './FileDropzone'; import Toaster from '../Toast'; import { useState } from 'react'; const meta: Meta = { title: 'Components/FileDropzone', component: FileDropzone, parameters: { layout: 'centered', }, tags: ['autodocs'], }; type Story = StoryObj; const defaultArgs = { accept: ['.png'], multiple: true, maxFiles: 5, maxSize: 5000000, maxSizeErrorMessage: 'Max file size limit of 5MB exceeded', invalidFileMessage: 'Invalid file format', fileExistMessage: 'File already exist with same name and type', }; export const Primary: Story = { args: { ...defaultArgs, }, }; export const withMIMEValidation: Story = { args: { ...defaultArgs, accept: [ 'image/png', 'image/jpeg', 'application/x-zip-compressed', 'application/zip', ], validateMIMEType: true, }, }; export const Controlled: Story = { render: () => { const [showToaster, setShowToaster] = useState(false); const showMaxFilesError = () => { setShowToaster(true); setTimeout(() => { setShowToaster(false); }, 2000); }; return ( <> {showToaster && ( )} ); }, }; export default meta;