Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
fix: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Chubarkin committed Jul 9, 2021
1 parent 8a18187 commit 336c615
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/upload/molecules/button-uploader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface ButtonUploaderProps {
icon?: React.ReactNode;
maxFiles?: DropzoneOptions['maxFiles'];
maxSize?: DropzoneOptions['maxFiles'];
multiple?: DropzoneOptions['multiple'];
onChange: DropzoneOptions['onDrop'];
onDrop: never;
validator?: DropzoneOptions['validator'];
Expand All @@ -26,6 +27,7 @@ export const ButtonUploaderBase: React.FC<ButtonUploaderProps & Priority> = ({
icon,
maxFiles,
maxSize,
multiple = false,
onChange,
outlined,
text,
Expand All @@ -37,6 +39,7 @@ export const ButtonUploaderBase: React.FC<ButtonUploaderProps & Priority> = ({
disabled,
maxFiles,
maxSize,
multiple,
noDrag: true,
onDrop: onChange,
validator,
Expand Down
25 changes: 13 additions & 12 deletions src/upload/molecules/button-uploader/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ To set file types, you should set the 'accept' property.

### Props

| Name | Type | Default | Description |
| ----------- | ---------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `accept` | `string ӏ string[]` | | File extensions that are accepted to load |
| `disabled` | `boolean` | `false` | Enable/disable upload button |
| `icon` | `React.ReactNode` | | Button icon |
| `maxFiles` | `number` | `0` | Max number of files to load. The default value is 0 which means there is no limitation to how many files are accepted. |
| `maxSize` | `number` | `Infinity` | Max file size (in bytes) |
| `onChange` | `fn` | | Callback for change event |
| `outlined` | `boolean` | `false` | Set button to be outlined |
| `priority` | `string` | `'secondary'` | Priority prop to style upload area |
| `text` | `string` | | Button text |
| `validator` | `<T extends File>(file: T) => FileError \| FileError[] \| null;` | | Fn that validate loaded files |
| Name | Type | Default | Description |
| ----------- | -------------------------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `accept` | `string ӏ string[]` | | File extensions that are accepted to load |
| `disabled` | `boolean` | `false` | Enable/disable upload button |
| `icon` | `React.ReactNode` | | Button icon |
| `maxFiles` | `number` | `0` | Max number of files to load. The default value is 0 which means there is no limitation to how many files are accepted. |
| `maxSize` | `number` | `Infinity` | Max file size (in bytes) |
| `multiple` | `boolean` | `false` | allow add multiple files |
| `onChange` | `<T extends File>(acceptedFiles: T[], fileRejections: FileRejection[], event: DropEvent) => void;` | | Callback for change event |
| `outlined` | `boolean` | `false` | Set button to be outlined |
| `priority` | `string` | `'secondary'` | Priority prop to style upload area |
| `text` | `string` | | Button text |
| `validator` | `<T extends File>(file: T) => FileError \| FileError[] \| null;` | | Fn that validate loaded files |
5 changes: 4 additions & 1 deletion src/upload/molecules/drag-uploader/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import {DragUploader} from './index';

# DragUploader

Drag and drop for files. Show dialog on drop file or upload area click
Drag and drop for files. To upload files, click or drop file on uploading area, choose files in an opened dialog window.
To set file types, you should set the 'accept' property. You can pass any content to show over uploading area.
DragUploader pass priority to style uploading area.

### Example

Expand Down Expand Up @@ -85,6 +87,7 @@ To set extensions of files that users can upload, you can pass an 'accept' prope
| `disabled` | `boolean` | `false` | Enable/disable DragUploader |
| `maxFiles` | `number` | `0` | Max number of files to load. The default value is 0 which means there is no limitation to how many files are accepted. |
| `maxSize` | `number` | `Infinity` | Max file size (in bytes) |
| `multiple` | `boolean` | `false` | allow add multiple files |
| `onDrop` | `<T extends File>(acceptedFiles: T[], fileRejections: FileRejection[], event: DropEvent) => void;` | | Callback for when the drop event occurs |
| `priority` | `string` | `'secondary'` | Priority prop to style UploaderArea component |
| `validator` | `<T extends File>(file: T) => FileError \| FileError[] \| null;` | | Fn that validate loaded files |

0 comments on commit 336c615

Please sign in to comment.