File tree Expand file tree Collapse file tree 1 file changed +41
-7
lines changed Expand file tree Collapse file tree 1 file changed +41
-7
lines changed Original file line number Diff line number Diff line change
1
+ import { useState } from 'react' ;
2
+
1
3
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
+ }
You can’t perform that action at this time.
0 commit comments