fleet/frontend/pages/ManageControlsPage/components/FileUploader/FileUploader.tsx
Luke Heath 0d9bd913fd
Revert file upload change to correct functionality (#10580)
For #10562 

--

This issue was introduced in
https://github.com/fleetdm/fleet/pull/10377, which was a minor styling
fix. Because this is a release blocker, and the styling issue is not, I
am reverting the change and re-opening the other bug so we can find an
alternate, non-breaking fix.
2023-03-17 15:26:15 -07:00

39 lines
887 B
TypeScript

import React from "react";
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>
<Button isLoading={isLoading}>
<label htmlFor="upload-profile">Upload</label>
</Button>
<input
accept=".mobileconfig,application/x-apple-aspen-config"
id="upload-profile"
type="file"
onChange={(e) => onFileUpload(e.target.files)}
/>
</div>
);
};
export default FileUploader;