Skip to content

Commit 66c26bb

Browse files
committed
Add loading state to DownloadAllLinks component with spinner and updated text
1 parent 683df92 commit 66c26bb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/links/download-all-links.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { downloadAllLinks } from "@/server/actions/links";
44
import { Button } from "@/ui/button";
5-
import { DownloadIcon } from "lucide-react";
5+
import { DownloadIcon, LoaderIcon } from "lucide-react";
66
import { useState } from "react";
77
import { toast } from "sonner";
88

@@ -37,8 +37,12 @@ const DownloadAllLinks = () => {
3737
onClick={handleDownloadLinks}
3838
disabled={isLoading}
3939
>
40-
<DownloadIcon size={14} />
41-
<span>Export Links</span>
40+
{isLoading ? (
41+
<LoaderIcon className="animate-spin" size={14} />
42+
) : (
43+
<DownloadIcon size={14} />
44+
)}
45+
<span>{isLoading ? "Exporting..." : "Export all links"}</span>
4246
</Button>
4347
);
4448
};

0 commit comments

Comments
 (0)