Skip to content

Commit

Permalink
better altnerative
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteri committed Nov 23, 2024
1 parent 609f4a8 commit 4cb70c5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/components/FileUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Modal, Button, Loader, Notification, FileInput } from '@mantine/core';
import { Modal, Button, Notification, FileInput } from '@mantine/core';
import '@/css/FileUpload.css';

interface FileUploadProps {
Expand All @@ -13,6 +13,7 @@ const FileUpload: React.FC<FileUploadProps> = ({ uploadUrl }) => {
const [success, setSuccess] = useState<string | null>(null);
const [loading, setLoading] = useState(false);


const handleFileChange = (files: File[]) => {
if (files.length > 0) {
setSelectedFiles((prevFiles) => [...prevFiles, ...files]);
Expand Down Expand Up @@ -107,12 +108,8 @@ const FileUpload: React.FC<FileUploadProps> = ({ uploadUrl }) => {
</div>
)}
</div>
{loading && (
<Loader color="blue" />
)}
<br/>
<Button onClick={handleUpload} style={{ marginTop: 10 }}>Upload</Button>

<Button loading={loading} loaderProps={{ type: 'dots' }} onClick={handleUpload} style={{ marginTop: 10 }} disabled={loading}>Upload</Button>

{success && (
<Notification color="green" onClose={() => setSuccess(null)} style={{ marginTop: 10 }}>
Expand Down

0 comments on commit 4cb70c5

Please sign in to comment.