Bläddra i källkod

Router fully functional

Alex Ortiz 1 år sedan
förälder
incheckning
b81be4905f
3 ändrade filer med 19 tillägg och 26 borttagningar
  1. 7
    7
      src/pages/Biography.tsx
  2. 6
    8
      src/pages/ListBiographies.tsx
  3. 6
    11
      src/pages/Questions.tsx

+ 7
- 7
src/pages/Biography.tsx Visa fil

@@ -5,23 +5,23 @@ import {
5 5
     IonTitle,
6 6
     IonToolbar,
7 7
     IonFooter,
8
-    IonNavLink,
9
-    IonButton,
10 8
     IonImg,
11 9
     IonGrid,
12 10
     IonRow,
13 11
     IonCol,
14 12
     IonButtons,
15 13
     IonBackButton,
16
-    useIonViewWillEnter
14
+    useIonViewWillEnter,
15
+    IonItem,
16
+    IonIcon
17 17
 } from '@ionic/react';
18 18
 import { useParams } from 'react-router';
19 19
 import React, { useState } from 'react';
20 20
 import { BioInfo, getMessage } from '../data/BioInfo';
21 21
 import './Biography.css';
22
-import Questions from './Questions';
23 22
 import EnciclopediaPR from '../assets/EnciclopediaPR.png';
24 23
 import RobertoClemente from '../assets/RobertoClemente.jpg';
24
+import { square } from 'ionicons/icons';
25 25
 
26 26
 const Biography: React.FC = () => {
27 27
     const [bioinfo, setMessage] = useState<BioInfo>();
@@ -57,9 +57,9 @@ const Biography: React.FC = () => {
57 57
                         <p>{bioinfo.tags}</p>
58 58
                         <p>{bioinfo.Text1}</p>
59 59
                         <p>{bioinfo.Text2}</p>
60
-                        <IonNavLink routerDirection="forward" component={() => <Questions />}>
61
-                            <IonButton>Tomar quiz</IonButton>
62
-                        </IonNavLink>
60
+                        <IonItem routerLink={`/Question`} detail={true}>
61
+                            <IonIcon icon={square} />Tomar quiz
62
+                        </IonItem>
63 63
                     </>
64 64
                 ) : (
65 65
                     <div>Message not found</div>

+ 6
- 8
src/pages/ListBiographies.tsx Visa fil

@@ -11,18 +11,17 @@ import {
11 11
   IonPage,
12 12
   IonTitle,
13 13
   IonToolbar,
14
-  IonButton,
15
-  IonNavLink,
16 14
   IonFooter,
17 15
   IonGrid,
18 16
   IonRow,
19 17
   IonCol,
20 18
   IonButtons,
21 19
   IonBackButton,
22
-  IonItem
20
+  IonItem,
21
+  IonIcon
23 22
 } from '@ionic/react';
24 23
 import './ListBiographies.css';
25
-import Questions from './Questions';
24
+import { square } from 'ionicons/icons';
26 25
 import EnciclopediaPR from '../assets/EnciclopediaPR.png';
27 26
 import RobertoClemente from '../assets/RobertoClemente.jpg';
28 27
 import ListBio from '../data/Biograph.json';
@@ -60,12 +59,11 @@ const ListBiographies: React.FC = () => {
60 59
                     </IonCardHeader><IonCardContent>
61 60
                       {listbio.content}
62 61
                     </IonCardContent>
63
-
64
-                    <IonNavLink routerDirection="forward" component={() => <Questions />}>
65
-                      <IonButton>Tomar quiz</IonButton>
66
-                    </IonNavLink>
67 62
                   </IonCard>
68 63
                 </IonItem>
64
+                <IonItem routerLink={`/Question`} detail={true}>
65
+                  <IonIcon icon={square} />Tomar quiz
66
+                </IonItem>
69 67
               </>
70 68
             )
71 69
           })

+ 6
- 11
src/pages/Questions.tsx Visa fil

@@ -5,9 +5,6 @@ import {
5 5
     IonTitle,
6 6
     IonToolbar,
7 7
     IonFooter,
8
-    IonNavLink,
9
-    IonTabButton,
10
-    IonIcon,
11 8
     IonImg,
12 9
     IonItem,
13 10
     IonLabel,
@@ -21,12 +18,12 @@ import {
21 18
     IonButton,
22 19
     IonGrid,
23 20
     IonRow,
24
-    IonCol
21
+    IonCol,
22
+    IonButtons,
23
+    IonBackButton
25 24
 } from '@ionic/react';
26
-import { arrowBack } from 'ionicons/icons';
27 25
 import React from 'react';
28 26
 import './Questions.css';
29
-import Biography from './Biography';
30 27
 import EnciclopediaPR from '../assets/EnciclopediaPR.png';
31 28
 import RobertoClemente from '../assets/RobertoClemente.jpg';
32 29
 
@@ -180,11 +177,9 @@ const Questions: React.FC = () => {
180 177
 
181 178
             <IonFooter>
182 179
                 <IonToolbar>
183
-                    <IonNavLink routerDirection="forward" component={() => <Biography />}>
184
-                        <IonTabButton tab="Biography" href="/Biography">
185
-                            <IonIcon icon={arrowBack} />
186
-                        </IonTabButton>
187
-                    </IonNavLink>
180
+                    <IonButtons slot="start">
181
+                        <IonBackButton defaultHref="/ListBiographie"></IonBackButton>
182
+                    </IonButtons>
188 183
                 </IonToolbar>
189 184
             </IonFooter>
190 185
         </IonPage>