2023-03-17 22:26:15 +00:00
|
|
|
import React from "react";
|
2023-03-06 15:03:48 +00:00
|
|
|
|
|
|
|
|
import Button from "components/buttons/Button";
|
|
|
|
|
import Icon from "components/Icon";
|
|
|
|
|
import { IconNames } from "components/icons";
|
|
|
|
|
|
|
|
|
|
const baseClass = "file-uploader";
|
|
|
|
|
|
|
|
|
|
interface IFileUploaderProps {
|
|
|
|
|
icon: IconNames;
|
|
|
|
|
message: string;
|
|
|
|
|
isLoading?: boolean;
|
|
|
|
|
onFileUpload: (files: FileList | null) => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FileUploader = ({
|
|
|
|
|
icon,
|
|
|
|
|
message,
|
|
|
|
|
isLoading = false,
|
|
|
|
|
onFileUpload,
|
|
|
|
|
}: IFileUploaderProps) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className={baseClass}>
|
|
|
|
|
<Icon name={icon} />
|
|
|
|
|
<p>{message}</p>
|
2023-03-20 15:36:54 +00:00
|
|
|
<Button variant="brand" isLoading={isLoading}>
|
2023-03-17 22:26:15 +00:00
|
|
|
<label htmlFor="upload-profile">Upload</label>
|
2023-03-06 15:03:48 +00:00
|
|
|
</Button>
|
|
|
|
|
<input
|
|
|
|
|
accept=".mobileconfig,application/x-apple-aspen-config"
|
|
|
|
|
id="upload-profile"
|
|
|
|
|
type="file"
|
|
|
|
|
onChange={(e) => onFileUpload(e.target.files)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default FileUploader;
|