Skip to content

Commit

Permalink
Merge branch 'main' into add-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
cgero-eth authored Jul 25, 2023
2 parents 0443532 + 8bcd5df commit 6ca9311
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed the contents of IconCopy and IconLinkExternal
- Added new icons - IconExplore, IconShrink, IconRadioPause, IconQuestion, and IconFailure

### Changed

- a new variable named acceptableFileFormat added to inputImage Component

## [0.2.7] - 2023-07-24

### Changed
Expand Down
1 change: 1 addition & 0 deletions src/components/input/inputImageSingle.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Single.args = {
minDimension: 256,
maxFileSize: 3000000,
onlySquare: true,
acceptableFileFormat: 'image/jpg, image/jpeg, image/png, image/gif',
onError: () =>
alert(
'Please provide a squared image (PNG, SVG, JPG or GIF) with a maximum of 3MB and size between 256px and 2400 px on each side',
Expand Down
7 changes: 6 additions & 1 deletion src/components/input/inputImageSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export type InputImageSingleProps = {
* Passing image src for preview
*/
preview?: string;
/**
* acceptable image formats
*/
acceptableFileFormat?: string;
};

export const InputImageSingle: React.FC<InputImageSingleProps> = ({
Expand All @@ -43,6 +47,7 @@ export const InputImageSingle: React.FC<InputImageSingleProps> = ({
maxFileSize,
onlySquare = false,
preview: previewSrc = '',
acceptableFileFormat = 'image/jpg, image/jpeg, image/png, image/gif, image/svg+xml',
onError,
}) => {
const [loading, setLoading] = useState<boolean>(false);
Expand Down Expand Up @@ -96,7 +101,7 @@ export const InputImageSingle: React.FC<InputImageSingleProps> = ({
} = useDropzone({
onDrop,
...(maxFileSize && { maxSize: maxFileSize }),
accept: 'image/jpg, image/jpeg, image/png, image/gif, image/svg+xml',
accept: acceptableFileFormat,
});

if (loading) {
Expand Down

0 comments on commit 6ca9311

Please sign in to comment.