Skip to content

Commit 10d2954

Browse files
committed
✨ NEW FEATURE - Download cover button
1 parent 6078eab commit 10d2954

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

src/components/Download.js

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,42 @@
1+
import { useState } from 'react';
2+
13
export default function Download() {
2-
return (
3-
<section className="download-section">
4-
<button id="downloadPDFButton">Download result</button>
5-
<button id="downloadJPGButton">Descargar como JPG</button>
6-
</section>
7-
);
8-
}
4+
const [isCoverVisible, setCoverVisible] = useState(true); // Controla la visibilidad del botón "Download"
5+
6+
// Esta función alterna la visibilidad entre el botón Download y los botones de PDF/JPG
7+
function handleDownloadClick() {
8+
setCoverVisible(false); // Oculta el botón "Download"
9+
}
10+
11+
function handleFileDownload() {
12+
setCoverVisible(true); // Vuelve a mostrar el botón "Download"
13+
}
14+
15+
return (
16+
<section className="download-section">
17+
<button
18+
onClick={handleDownloadClick}
19+
style={{ visibility: isCoverVisible ? 'visible' : 'hidden' }}
20+
id='downloadCOVERButton'
21+
>
22+
Download
23+
</button>
24+
25+
<button
26+
onClick={handleFileDownload}
27+
style={{ visibility: isCoverVisible ? 'hidden' : 'visible' }}
28+
id='downloadPDFButton'
29+
>
30+
PDF (printing)
31+
</button>
32+
33+
<button
34+
onClick={handleFileDownload}
35+
style={{ visibility: isCoverVisible ? 'hidden' : 'visible' }}
36+
id='downloadJPGButton'
37+
>
38+
JPG (model)
39+
</button>
40+
</section>
41+
);
42+
}

0 commit comments

Comments
 (0)