Browse Source

Flag Page Update

cynthiarivera15 2 years ago
parent
commit
938635d563
1 changed files with 26 additions and 26 deletions
  1. 26
    26
      src/pages/Flag.tsx

+ 26
- 26
src/pages/Flag.tsx View File

@@ -1,11 +1,11 @@
1 1
 import { IonCardHeader, IonCardTitle } from '@ionic/core/components';
2
-import React, { useState } from 'react';
2
+import React, { useState, useRef, useEffect } from 'react';
3 3
 import { IonButton, IonButtons, IonCard, IonCol, IonContent, IonGrid, IonHeader, IonModal, IonPage, IonRow, IonText, IonTitle, IonToolbar } from '@ionic/react';
4 4
 import ExploreContainer from '../components/ExploreContainer';
5 5
 import './Flag.css';
6 6
 
7 7
 const Flag: React.FC = () => {
8
-  const [isOpen, setIsOpen] = useState(false);
8
+  const modal = useRef<HTMLIonModalElement>(null);
9 9
 
10 10
   return (
11 11
     <IonPage>
@@ -25,15 +25,15 @@ const Flag: React.FC = () => {
25 25
         <IonGrid>
26 26
           <IonRow>
27 27
             <IonCol>
28
-                <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
28
+                <IonButton id="open-amenazas" color="light" expand="block">
29 29
                   Amenazas
30 30
                 </IonButton>
31
-                <IonModal isOpen={isOpen}>
31
+                <IonModal ref={modal} keepContentsMounted={true} trigger="open-amenazas">
32 32
                   <IonHeader>
33 33
                     <IonToolbar>
34 34
                       <IonTitle>Amenazas</IonTitle>
35 35
                       <IonButtons slot="end">
36
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
36
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
37 37
                       </IonButtons>
38 38
                    </IonToolbar>
39 39
                   </IonHeader>
@@ -54,15 +54,15 @@ const Flag: React.FC = () => {
54 54
                 </IonModal>
55 55
             </IonCol>
56 56
             <IonCol>
57
-                <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
57
+                <IonButton id="open-intimidacion" color="light" expand="block" >
58 58
                   Intimidación
59 59
                 </IonButton>
60
-                <IonModal isOpen={isOpen}>
60
+                <IonModal ref={modal} keepContentsMounted={true} trigger="open-intimidacion">
61 61
                   <IonHeader>
62 62
                     <IonToolbar>
63 63
                       <IonTitle>Intimidación</IonTitle>
64 64
                       <IonButtons slot="end">
65
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
65
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
66 66
                       </IonButtons>
67 67
                    </IonToolbar>
68 68
                   </IonHeader>
@@ -82,15 +82,15 @@ const Flag: React.FC = () => {
82 82
           </IonRow>
83 83
           <IonRow>
84 84
             <IonCol>
85
-              <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
85
+              <IonButton id="open-abuso-emocional" color="light" expand="block">
86 86
                  Abuso Emocional
87 87
                 </IonButton>
88
-                <IonModal isOpen={isOpen}>
88
+                <IonModal ref={modal} trigger="open-abuso-emocional">
89 89
                   <IonHeader>
90 90
                     <IonToolbar>
91 91
                       <IonTitle>Abuso Emocional</IonTitle>
92 92
                       <IonButtons slot="end">
93
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
93
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
94 94
                       </IonButtons>
95 95
                    </IonToolbar>
96 96
                   </IonHeader>
@@ -120,15 +120,15 @@ const Flag: React.FC = () => {
120 120
                 </IonModal>
121 121
             </IonCol>
122 122
             <IonCol>
123
-              <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
123
+              <IonButton id="open-aislamiento" color="light" expand="block">
124 124
                  Aislamiento
125 125
                 </IonButton>
126
-                <IonModal isOpen={isOpen}>
126
+                <IonModal ref={modal} trigger="open-aislamiento">
127 127
                   <IonHeader>
128 128
                     <IonToolbar>
129 129
                       <IonTitle>Aislamiento</IonTitle>
130 130
                       <IonButtons slot="end">
131
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
131
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
132 132
                       </IonButtons>
133 133
                    </IonToolbar>
134 134
                   </IonHeader>
@@ -145,15 +145,15 @@ const Flag: React.FC = () => {
145 145
           </IonRow>
146 146
           <IonRow>
147 147
             <IonCol>
148
-            <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
148
+            <IonButton id="open-des-neg-cul" color="light" expand="block">
149 149
                  Desvalorizar, Negar, Culpar
150 150
                 </IonButton>
151
-                <IonModal isOpen={isOpen}>
151
+                <IonModal  ref={modal} trigger="open-des-neg-cul">
152 152
                   <IonHeader>
153 153
                     <IonToolbar>
154 154
                       <IonTitle>Desvalorizar, Negar, Culpar</IonTitle>
155 155
                       <IonButtons slot="end">
156
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
156
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
157 157
                       </IonButtons>
158 158
                    </IonToolbar>
159 159
                   </IonHeader>
@@ -171,15 +171,15 @@ const Flag: React.FC = () => {
171 171
                 </IonModal>
172 172
             </IonCol>
173 173
             <IonCol>
174
-              <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
174
+              <IonButton id="open-manipulacion" color="light" expand="block">
175 175
                  Manipulación de los Niño(a)s
176 176
                 </IonButton>
177
-                <IonModal isOpen={isOpen}>
177
+                <IonModal ref={modal} trigger="open-manipulacion">
178 178
                   <IonHeader>
179 179
                     <IonToolbar>
180 180
                       <IonTitle>Manipulación de los Niño(a)s</IonTitle>
181 181
                       <IonButtons slot="end">
182
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
182
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
183 183
                       </IonButtons>
184 184
                    </IonToolbar>
185 185
                   </IonHeader>
@@ -199,15 +199,15 @@ const Flag: React.FC = () => {
199 199
           </IonRow>
200 200
           <IonRow>
201 201
             <IonCol>
202
-            <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
202
+            <IonButton id="open-abuso-economico" color="light" expand="block">
203 203
                  Abuso Económico
204 204
                 </IonButton>
205
-                <IonModal isOpen={isOpen}>
205
+                <IonModal ref={modal} trigger="open-abuso-economico">
206 206
                   <IonHeader>
207 207
                     <IonToolbar>
208 208
                       <IonTitle>Abuso Económico</IonTitle>
209 209
                       <IonButtons slot="end">
210
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
210
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
211 211
                       </IonButtons>
212 212
                    </IonToolbar>
213 213
                   </IonHeader>
@@ -231,15 +231,15 @@ const Flag: React.FC = () => {
231 231
                 </IonModal>
232 232
             </IonCol>
233 233
             <IonCol>
234
-              <IonButton color="light" expand="block" onClick={() => setIsOpen(true)}>
234
+              <IonButton id="open-priv-masculino" color="light" expand="block">
235 235
                  Privilegio Masculino
236 236
                 </IonButton>
237
-                <IonModal isOpen={isOpen}>
237
+                <IonModal ref={modal} trigger="open-priv-masculino">
238 238
                   <IonHeader>
239 239
                     <IonToolbar>
240 240
                       <IonTitle>Privilegio Masculino</IonTitle>
241 241
                       <IonButtons slot="end">
242
-                        <IonButton color="light" onClick={() => setIsOpen(false)}>Cerrar</IonButton>
242
+                        <IonButton color="light" onClick={() => modal.current?.dismiss()}>Cerrar</IonButton>
243 243
                       </IonButtons>
244 244
                    </IonToolbar>
245 245
                   </IonHeader>