From 69347974fc5ecfc6c961f5808bcf8d495233dfb0 Mon Sep 17 00:00:00 2001 From: Jadessu Date: Mon, 6 Jan 2025 21:04:33 +0000 Subject: [PATCH 1/2] add requested changes --- src/components/ImageDisplay/ImageDisplay.jsx | 26 ++++++++++++------- .../ImageDisplay/ImageDisplay.module.css | 4 ++- src/pages/FutaSection1.jsx | 1 - src/pages/FutaSection10/FutaSection10.jsx | 6 +++++ .../FutaSection10/FutaSection10.module.css | 14 ++++++++++ src/pages/FutaSection11/FutaSection11.jsx | 6 +++-- .../FutaSection11/FutaSection11.module.css | 19 +++++++++++--- .../FutaSection12/FutaSection12.module.css | 4 +-- src/pages/FutaSection2.jsx | 8 +++--- src/pages/FutaSection3.jsx | 8 +++--- src/pages/FutaSection4.jsx | 6 +++-- src/pages/FutaSection5.jsx | 6 +++-- src/pages/FutaSection6.jsx | 8 +++--- src/pages/FutaSection7.jsx | 8 +++--- src/pages/FutaSection8.jsx | 6 +++-- src/pages/FutaSection9/FutaSection9.jsx | 2 +- src/pages/Sections.module.css | 11 ++++++++ 17 files changed, 104 insertions(+), 39 deletions(-) diff --git a/src/components/ImageDisplay/ImageDisplay.jsx b/src/components/ImageDisplay/ImageDisplay.jsx index 826628e..c7e12e2 100644 --- a/src/components/ImageDisplay/ImageDisplay.jsx +++ b/src/components/ImageDisplay/ImageDisplay.jsx @@ -14,7 +14,7 @@ import wordColor from '../../assets/images/section7Image.svg'; import wordMonochrome01 from '../../assets/images/section8FirstImage.svg'; import wordMonochrome02 from '../../assets/images/section8SecondImage.svg'; export default function ImageDisplay(props) { - const { image, image2, zipDownload } = props; + const { image, image2, zipDownload, imageName } = props; const images = [ { name: 'fullLogo.svg', url: fullLogo }, @@ -68,18 +68,23 @@ export default function ImageDisplay(props) { }); }; - // Function to download an image - const downloadImage = (src, filename) => { - // Create a temporary anchor element + const downloadImage = async (src, filename) => { + const response = await fetch(src); + const blob = await response.blob(); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); - link.href = src; + link.href = url; link.download = filename || 'downloaded-image'; - - // Append to the body, click, and remove + document.body.appendChild(link); link.click(); document.body.removeChild(link); + + // Clean up the object URL + URL.revokeObjectURL(url); }; + // Function to generate filename const generateFilename = (src) => { @@ -95,7 +100,7 @@ export default function ImageDisplay(props) {