Accept gif and webp for images (#2551)

This commit is contained in:
WithoutPants 2022-05-04 09:27:50 +10:00 committed by GitHub
parent e87fd516d6
commit 20ffd4d51d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -19,6 +19,10 @@ interface IImageInput {
acceptSVG?: boolean;
}
function acceptExtensions(acceptSVG: boolean = false) {
return `.jpg,.jpeg,.png,.webp,.gif${acceptSVG ? ",.svg" : ""}`;
}
export const ImageInput: React.FC<IImageInput> = ({
isEditing,
text,
@ -42,7 +46,7 @@ export const ImageInput: React.FC<IImageInput> = ({
<Form.Control
type="file"
onChange={onImageChange}
accept={`.jpg,.jpeg,.png${acceptSVG ? ",.svg" : ""}`}
accept={acceptExtensions(acceptSVG)}
/>
</Form.Label>
);
@ -102,7 +106,7 @@ export const ImageInput: React.FC<IImageInput> = ({
<Form.Control
type="file"
onChange={onImageChange}
accept={`.jpg,.jpeg,.png${acceptSVG ? ",.svg" : ""}`}
accept={acceptExtensions(acceptSVG)}
/>
</Form.Label>
</div>