Skip to content

Commit

Permalink
change prop to camelcase
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Gramlich committed Apr 24, 2023
1 parent fb49535 commit 00ee231
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions docs/FileInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and
| `multiple` | Optional | `boolean` | `false` | Whether the inputs can accept multiple files. |
| `options` | Optional | `Object` | `{}` | Additional options passed to react-dropzone's `useDropzone()` hook. |
| `placeholder` | Optional | `ReactNode` | - | Invite displayed in the drop zone |
| `RemoveIcon` | Optional | `ReactNode` | [MUI's RemoveCircle icon](https://mui.com/material-ui/material-icons/?query=removeCir&selected=RemoveCircle) | The clickable icon for removing files |
| `removeIcon` | Optional | `ReactNode` | [MUI's RemoveCircle icon](https://mui.com/material-ui/material-icons/?query=removeCir&selected=RemoveCircle) | The clickable icon for removing files |
| `validateFile Removal` | Optional | `function` | - | Allows to cancel the removal of files |

`<FileInput>` also accepts the [common input props](./Inputs.md#common-input-props).
Expand Down Expand Up @@ -153,12 +153,12 @@ If that's not enough, you can pass a `placeholder` prop to overwrite it. The val
</FileInput>
```

## `RemoveIcon`
## `removeIcon`

Use the `RemoveIcon` prop to change the icon displayed as the remove button:
Use the `removeIcon` prop to change the icon displayed as the remove button:

```jsx
<ImageInput source="attachments" RemoveIcon={CustomSvgIcon}>
<ImageInput source="attachments" removeIcon={CustomSvgIcon}>
<ImageField source="src" title="title" />
</ImageInput>
```
Expand Down
8 changes: 4 additions & 4 deletions docs/ImageInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and
| `multiple` | Optional | `boolean` | `false` | Whether the inputs can accept multiple files. |
| `options` | Optional | `Object` | `{}` | Additional options passed to react-dropzone's `useDropzone()` hook. |
| `placeholder` | Optional | `ReactNode` | - | Invite displayed in the drop zone |
| `RemoveIcon` | Optional | `ReactNode` | [MUI's RemoveCircle icon](https://mui.com/material-ui/material-icons/?query=removeCir&selected=RemoveCircle) | The clickable icon for removing images |
| `removeIcon` | Optional | `ReactNode` | [MUI's RemoveCircle icon](https://mui.com/material-ui/material-icons/?query=removeCir&selected=RemoveCircle) | The clickable icon for removing images |
| `validateFile Removal` | Optional | `function` | - | Allows to cancel the removal of files |

`<ImageInput>` also accepts the [common input props](./Inputs.md#common-input-props).
Expand Down Expand Up @@ -150,12 +150,12 @@ If that's not enough, you can pass a `placeholder` prop to overwrite it. The val
</ImageInput>
```

## `RemoveIcon`
## `removeIcon`

Use the `RemoveIcon` prop to change the icon displayed as the remove button:
Use the `removeIcon` prop to change the icon displayed as the remove button:

```jsx
<ImageInput source="pictures" RemoveIcon={CustomSvgIcon}>
<ImageInput source="pictures" removeIcon={CustomSvgIcon}>
<ImageField source="src" title="title" />
</ImageInput>
```
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/FileInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const Disabled = () => (

export const CustomRemoveIcon = () => (
<Wrapper>
<FileInput source="attachments" RemoveIcon={DeleteIcon}>
<FileInput source="attachments" removeIcon={DeleteIcon}>
<FileField source="src" title="title" />
</FileInput>
<FormInspector name="attachments" />
Expand Down
8 changes: 4 additions & 4 deletions packages/ra-ui-materialui/src/input/FileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const FileInput = (props: FileInputProps) => {
onRemove: onRemoveProp,
parse,
placeholder,
RemoveIcon,
removeIcon,
resource,
source,
validate,
Expand Down Expand Up @@ -195,7 +195,7 @@ export const FileInput = (props: FileInputProps) => {
file={file}
onRemove={onRemove(file)}
className={FileInputClasses.removeButton}
RemoveIcon={RemoveIcon}
removeIcon={removeIcon}
>
<RecordContextProvider value={file}>
{childrenElement}
Expand Down Expand Up @@ -227,7 +227,7 @@ FileInput.propTypes = {
multiple: PropTypes.bool,
validateFileRemoval: PropTypes.func,
options: PropTypes.object,
RemoveIcon: PropTypes.elementType,
removeIcon: PropTypes.elementType,
resource: PropTypes.string,
source: PropTypes.string,
placeholder: PropTypes.node,
Expand Down Expand Up @@ -269,7 +269,7 @@ export type FileInputProps = CommonInputProps & {
options?: DropzoneOptions;
onRemove?: Function;
placeholder?: ReactNode;
RemoveIcon?: FC<SvgIconProps>;
removeIcon?: FC<SvgIconProps>;
inputProps?: any;
validateFileRemoval?(file): boolean | Promise<boolean>;
sx?: SxProps;
Expand Down
6 changes: 3 additions & 3 deletions packages/ra-ui-materialui/src/input/FileInputPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const FileInputPreview = (props: FileInputPreviewProps) => {
className,
onRemove,
file,
RemoveIcon = RemoveCircle,
removeIcon: RemoveIcon = RemoveCircle,
...rest
} = props;

Expand Down Expand Up @@ -50,7 +50,7 @@ FileInputPreview.propTypes = {
className: PropTypes.string,
file: PropTypes.object,
onRemove: PropTypes.func.isRequired,
RemoveIcon: PropTypes.element,
removeIcon: PropTypes.element,
};

FileInputPreview.defaultProps = {
Expand Down Expand Up @@ -80,5 +80,5 @@ export interface FileInputPreviewProps {
className?: string;
onRemove: () => void;
file: any;
RemoveIcon?: FC<SvgIconProps>;
removeIcon?: FC<SvgIconProps>;
}
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/ImageInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const Required = () => (

export const CustomRemoveIcon = () => (
<Wrapper>
<ImageInput source="image" RemoveIcon={DeleteIcon}>
<ImageInput source="image" removeIcon={DeleteIcon}>
<ImageField source="src" title="title" />
</ImageInput>
<FormInspector name="attachments" />
Expand Down

0 comments on commit 00ee231

Please sign in to comment.