static-cms/core/src/components/UI/FileUploadButton.tsx
Daniel Lautzenheiser 421ecf17e6
Feature/website overhaul (#49)
* Reorganize repo
* Overhaul website design and rewrite in NextJS and Typescript
* Delete website-publish.yml
2022-10-25 09:18:18 -04:00

28 lines
641 B
TypeScript

import Button from '@mui/material/Button';
import React from 'react';
export interface FileUploadButtonProps {
label: string;
imagesOnly?: boolean;
onChange: React.ChangeEventHandler<HTMLInputElement>;
disabled?: boolean;
}
const FileUploadButton = ({ label, imagesOnly, onChange, disabled }: FileUploadButtonProps) => {
return (
<Button variant="contained" component="label">
{label}
<input
hidden
multiple
type="file"
accept={imagesOnly ? 'image/*' : '*/*'}
onChange={onChange}
disabled={disabled}
/>
</Button>
);
};
export default FileUploadButton;