Spaces:
Sleeping
Sleeping
Update src/components/deploy-button/deploy-button.tsx
Browse files
src/components/deploy-button/deploy-button.tsx
CHANGED
@@ -16,20 +16,25 @@ function DeployButton({ html }: { html: string }) {
|
|
16 |
|
17 |
const handleDownload = () => {
|
18 |
setLoading(true);
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
};
|
22 |
|
23 |
return (
|
24 |
<div className="relative flex items-center justify-end">
|
25 |
<button
|
26 |
className={classNames(
|
27 |
-
"relative cursor-pointer flex-none flex items-center justify-center rounded-md text-xs lg:text-sm font-semibold leading-5 lg:leading-6 py-2 px-6 hover:bg-pink-400 text-white bg-pink-500 shadow-sm dark:shadow-highlight/20 transition-all duration-100"
|
|
|
|
|
|
|
28 |
)}
|
29 |
onClick={handleDownload}
|
30 |
disabled={loading}
|
31 |
>
|
32 |
-
{loading ? "Preparing..." : "Download
|
33 |
</button>
|
34 |
</div>
|
35 |
);
|
|
|
16 |
|
17 |
const handleDownload = () => {
|
18 |
setLoading(true);
|
19 |
+
setTimeout(() => {
|
20 |
+
downloadFile("index.html", html);
|
21 |
+
setLoading(false);
|
22 |
+
}, 300); // slight delay for UX feedback
|
23 |
};
|
24 |
|
25 |
return (
|
26 |
<div className="relative flex items-center justify-end">
|
27 |
<button
|
28 |
className={classNames(
|
29 |
+
"relative cursor-pointer flex-none flex items-center justify-center rounded-md text-xs lg:text-sm font-semibold leading-5 lg:leading-6 py-2 px-6 hover:bg-pink-400 text-white bg-pink-500 shadow-sm dark:shadow-highlight/20 transition-all duration-100",
|
30 |
+
{
|
31 |
+
"opacity-50 cursor-not-allowed": loading,
|
32 |
+
}
|
33 |
)}
|
34 |
onClick={handleDownload}
|
35 |
disabled={loading}
|
36 |
>
|
37 |
+
{loading ? "Preparing..." : "Download HTML"}
|
38 |
</button>
|
39 |
</div>
|
40 |
);
|