Skip to content

Commit

Permalink
Add loading state to DownloadAllLinks component with spinner and upda…
Browse files Browse the repository at this point in the history
…ted text
  • Loading branch information
pheralb committed Jan 9, 2025
1 parent 683df92 commit 66c26bb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/links/download-all-links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { downloadAllLinks } from "@/server/actions/links";
import { Button } from "@/ui/button";
import { DownloadIcon } from "lucide-react";
import { DownloadIcon, LoaderIcon } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";

Expand Down Expand Up @@ -37,8 +37,12 @@ const DownloadAllLinks = () => {
onClick={handleDownloadLinks}
disabled={isLoading}
>
<DownloadIcon size={14} />
<span>Export Links</span>
{isLoading ? (
<LoaderIcon className="animate-spin" size={14} />
) : (
<DownloadIcon size={14} />
)}
<span>{isLoading ? "Exporting..." : "Export all links"}</span>
</Button>
);
};
Expand Down

0 comments on commit 66c26bb

Please sign in to comment.