Spaces:
No application file
No application file
File size: 942 Bytes
2be9eb9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faUpload } from '@fortawesome/free-solid-svg-icons';
import styles from '../styles/index.module.css';
interface FileUploadProps {
onFileUpload: (file: File) => void;
}
export default function FileUpload({ onFileUpload }: FileUploadProps) {
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
if (file) {
onFileUpload(file);
}
};
return (
<div className={styles.fileUpload}>
<label
title="Upload file"
htmlFor="fileInput"
className={styles.fileInputLabel}
>
<FontAwesomeIcon icon={faUpload} size="2x" />
<span className={styles.uploadText}>Upload file</span>
</label>
<input
type="file"
id="fileInput"
onChange={handleFileChange}
className={styles.fileInput}
/>
</div>
);
}
|