Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] download button style improvements #94

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions components/BrandKitGallery/DownloadButton.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// components/BrandKitGallery/DownloadButton.tsx
import React from 'react';
import styles from '../../styles/custom.module.css';

import { DownloadIcon } from "lucide-react";

const DownloadButton = ({ url, fileName, children }) => {
const handleDownload = () => {
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', fileName);
// TODO: add target blank
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};

return (
<button className={styles.downloadButton} onClick={handleDownload}>
{children}
<button className="inline-flex items-center px-4 py-1.5 font-semibold bg-black text-white rounded-lg hover:bg-gray-800 dark:bg-white dark:text-black dark:hover:bg-gray-200 transition-all duration-200 active:translate-y-px" onClick={handleDownload}>
{children} <DownloadIcon className="w-4 h-4 ml-2" />
</button>
);
};
Expand Down
Loading