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