feat: add loading spinner during file upload process (#4491)

* show LoaderIcon while uploading file

* fix spacing for eslint
pull/4492/head
Simon 7 months ago committed by GitHub
parent 7a438be08d
commit 690f28bed8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,5 +1,5 @@
import { Button } from "@usememos/mui";
import { PaperclipIcon } from "lucide-react";
import { LoaderIcon, PaperclipIcon } from "lucide-react";
import { useContext, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useResourceStore } from "@/store/v1";
@ -67,7 +67,7 @@ const UploadResourceButton = () => {
return (
<Button className="relative" size="sm" variant="plain" disabled={state.uploadingFlag}>
<PaperclipIcon className="w-5 h-5 mx-auto" />
{state.uploadingFlag ? <LoaderIcon className="w-5 h-5 mx-auto animate-spin" /> : <PaperclipIcon className="w-5 h-5 mx-auto" />}
<input
className="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
ref={fileInputRef}

Loading…
Cancel
Save