Skip to content
Snippets Groups Projects
Commit c33939e2 authored by Asal Sahami Moghaddam's avatar Asal Sahami Moghaddam
Browse files
parents ff9d4b7a d89ac19b
No related branches found
No related tags found
No related merge requests found
Pipeline #458759 failed
...@@ -72,17 +72,40 @@ const handleDownload = () => { ...@@ -72,17 +72,40 @@ const handleDownload = () => {
console.error("Error fetching the file:", error); console.error("Error fetching the file:", error);
}); });
}; };
};
export const DownloadImageButton = ({ url, fileName, children}: {url: string, fileName: string, children: React.ReactNode}) => {
const handleDownload = () => {
fetch(url)
.then((response) => response.blob())
.then((blob) => {
const url = window.URL.createObjectURL(new Blob([blob]));
const link = document.createElement("a");
link.href = url;
link.download = fileName || "downloaded-file";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
})
.catch((error) => {
console.error("Error fetching the file:", error);
});
};
return ( return (
<a type="button" onClick={handleDownload} className="download-butt"> <a type="button" onClick={handleDownload} className="download-butt">
Download {children}
</a> </a>
); );
}; };
export function TabButtonRow({data, classy, opentype, closing}: {data: Array<TabDatensatz>, classy?: string, opentype: string, closing: string}){ export function TabButtonRow({data, classy, opentype, closing}: {data: Array<TabDatensatz>, classy?: string, opentype: string, closing: string}){
let rows = [] let rows = []
for ( let i = 0; i < data.length; i++ ){ for ( let i = 0; i < data.length; i++ ){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment