瀏覽代碼

Primer commit: Solo se ve quiz de Clemente pero ya guarda las respuestas

ryanbarreto1 1 年之前
父節點
當前提交
137c2b1709
共有 6 個檔案被更改,包括 474 行新增128 行删除
  1. 202
    0
      package-lock.json
  2. 2
    0
      package.json
  3. 15
    0
      src/components/QuizForm.tsx
  4. 75
    0
      src/data/Quizzes.json
  5. 20
    0
      src/pages/Questions.css
  6. 160
    128
      src/pages/Questions.tsx

+ 202
- 0
package-lock.json 查看文件

@@ -24,9 +24,11 @@
24 24
         "@types/react-dom": "^18.0.6",
25 25
         "@types/react-router": "^5.1.11",
26 26
         "@types/react-router-dom": "^5.1.7",
27
+        "bootstrap": "^5.2.3",
27 28
         "history": "^4.9.0",
28 29
         "ionicons": "^6.0.3",
29 30
         "react": "^18.2.0",
31
+        "react-bootstrap": "^2.7.0",
30 32
         "react-dom": "^18.2.0",
31 33
         "react-router": "^5.2.0",
32 34
         "react-router-dom": "^5.2.0",
@@ -3344,6 +3346,57 @@
3344 3346
         }
3345 3347
       }
3346 3348
     },
3349
+    "node_modules/@popperjs/core": {
3350
+      "version": "2.11.6",
3351
+      "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
3352
+      "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
3353
+      "funding": {
3354
+        "type": "opencollective",
3355
+        "url": "https://opencollective.com/popperjs"
3356
+      }
3357
+    },
3358
+    "node_modules/@react-aria/ssr": {
3359
+      "version": "3.4.0",
3360
+      "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.4.0.tgz",
3361
+      "integrity": "sha512-qzuGk14/fUyUAoW/EBwgFcuMkVNXJVGlezTgZ1HovpCZ+p9844E7MUFHE7CuzFzPEIkVeqhBNIoIu+VJJ8YCOA==",
3362
+      "dependencies": {
3363
+        "@babel/runtime": "^7.6.2"
3364
+      },
3365
+      "peerDependencies": {
3366
+        "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
3367
+      }
3368
+    },
3369
+    "node_modules/@restart/hooks": {
3370
+      "version": "0.4.7",
3371
+      "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.7.tgz",
3372
+      "integrity": "sha512-ZbjlEHcG+FQtpDPHd7i4FzNNvJf2enAwZfJbpM8CW7BhmOAbsHpZe3tsHwfQUrBuyrxWqPYp2x5UMnilWcY22A==",
3373
+      "dependencies": {
3374
+        "dequal": "^2.0.2"
3375
+      },
3376
+      "peerDependencies": {
3377
+        "react": ">=16.8.0"
3378
+      }
3379
+    },
3380
+    "node_modules/@restart/ui": {
3381
+      "version": "1.4.1",
3382
+      "resolved": "https://registry.npmjs.org/@restart/ui/-/ui-1.4.1.tgz",
3383
+      "integrity": "sha512-J7wFOx2DcmkBqCqiZgDsggLO7faiNh4Nv1/v80FmbRgP+MYpwaVDKKXLC69DA4+ejgNIsBP5ORtC74EZqO1j8A==",
3384
+      "dependencies": {
3385
+        "@babel/runtime": "^7.18.3",
3386
+        "@popperjs/core": "^2.11.5",
3387
+        "@react-aria/ssr": "^3.2.0",
3388
+        "@restart/hooks": "^0.4.7",
3389
+        "@types/warning": "^3.0.0",
3390
+        "dequal": "^2.0.2",
3391
+        "dom-helpers": "^5.2.0",
3392
+        "uncontrollable": "^7.2.1",
3393
+        "warning": "^4.0.3"
3394
+      },
3395
+      "peerDependencies": {
3396
+        "react": ">=16.14.0",
3397
+        "react-dom": ">=16.14.0"
3398
+      }
3399
+    },
3347 3400
     "node_modules/@rollup/plugin-babel": {
3348 3401
       "version": "5.3.1",
3349 3402
       "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@@ -4132,6 +4185,14 @@
4132 4185
         "@types/react-router": "*"
4133 4186
       }
4134 4187
     },
4188
+    "node_modules/@types/react-transition-group": {
4189
+      "version": "4.4.5",
4190
+      "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.5.tgz",
4191
+      "integrity": "sha512-juKD/eiSM3/xZYzjuzH6ZwpP+/lejltmiS3QEzV/vmb/Q8+HfDmxu+Baga8UEMGBqV88Nbg4l2hY/K2DkyaLLA==",
4192
+      "dependencies": {
4193
+        "@types/react": "*"
4194
+      }
4195
+    },
4135 4196
     "node_modules/@types/resolve": {
4136 4197
       "version": "1.17.1",
4137 4198
       "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz",
@@ -4212,6 +4273,11 @@
4212 4273
       "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==",
4213 4274
       "dev": true
4214 4275
     },
4276
+    "node_modules/@types/warning": {
4277
+      "version": "3.0.0",
4278
+      "resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.0.tgz",
4279
+      "integrity": "sha512-t/Tvs5qR47OLOr+4E9ckN8AmP2Tf16gWq+/qA4iUGS/OOyHVO8wv2vjJuX8SNOUTJyWb+2t7wJm6cXILFnOROA=="
4280
+    },
4215 4281
     "node_modules/@types/ws": {
4216 4282
       "version": "8.5.3",
4217 4283
       "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
@@ -5499,6 +5565,24 @@
5499 5565
       "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
5500 5566
       "dev": true
5501 5567
     },
5568
+    "node_modules/bootstrap": {
5569
+      "version": "5.2.3",
5570
+      "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
5571
+      "integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
5572
+      "funding": [
5573
+        {
5574
+          "type": "github",
5575
+          "url": "https://github.com/sponsors/twbs"
5576
+        },
5577
+        {
5578
+          "type": "opencollective",
5579
+          "url": "https://opencollective.com/bootstrap"
5580
+        }
5581
+      ],
5582
+      "peerDependencies": {
5583
+        "@popperjs/core": "^2.11.6"
5584
+      }
5585
+    },
5502 5586
     "node_modules/bplist-parser": {
5503 5587
       "version": "0.3.2",
5504 5588
       "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.2.tgz",
@@ -5803,6 +5887,11 @@
5803 5887
       "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==",
5804 5888
       "dev": true
5805 5889
     },
5890
+    "node_modules/classnames": {
5891
+      "version": "2.3.2",
5892
+      "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz",
5893
+      "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw=="
5894
+    },
5806 5895
     "node_modules/clean-css": {
5807 5896
       "version": "5.3.1",
5808 5897
       "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.1.tgz",
@@ -6769,6 +6858,14 @@
6769 6858
         "node": ">= 0.8"
6770 6859
       }
6771 6860
     },
6861
+    "node_modules/dequal": {
6862
+      "version": "2.0.3",
6863
+      "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
6864
+      "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
6865
+      "engines": {
6866
+        "node": ">=6"
6867
+      }
6868
+    },
6772 6869
     "node_modules/destroy": {
6773 6870
       "version": "1.2.0",
6774 6871
       "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
@@ -6919,6 +7016,15 @@
6919 7016
         "utila": "~0.4"
6920 7017
       }
6921 7018
     },
7019
+    "node_modules/dom-helpers": {
7020
+      "version": "5.2.1",
7021
+      "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",
7022
+      "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",
7023
+      "dependencies": {
7024
+        "@babel/runtime": "^7.8.7",
7025
+        "csstype": "^3.0.2"
7026
+      }
7027
+    },
6922 7028
     "node_modules/dom-serializer": {
6923 7029
       "version": "1.4.1",
6924 7030
       "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
@@ -9393,6 +9499,14 @@
9393 9499
         "node": ">= 0.4"
9394 9500
       }
9395 9501
     },
9502
+    "node_modules/invariant": {
9503
+      "version": "2.2.4",
9504
+      "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
9505
+      "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
9506
+      "dependencies": {
9507
+        "loose-envify": "^1.0.0"
9508
+      }
9509
+    },
9396 9510
     "node_modules/ionicons": {
9397 9511
       "version": "6.0.4",
9398 9512
       "resolved": "https://registry.npmjs.org/ionicons/-/ionicons-6.0.4.tgz",
@@ -13714,6 +13828,23 @@
13714 13828
         "react-is": "^16.13.1"
13715 13829
       }
13716 13830
     },
13831
+    "node_modules/prop-types-extra": {
13832
+      "version": "1.1.1",
13833
+      "resolved": "https://registry.npmjs.org/prop-types-extra/-/prop-types-extra-1.1.1.tgz",
13834
+      "integrity": "sha512-59+AHNnHYCdiC+vMwY52WmvP5dM3QLeoumYuEyceQDi9aEhtwN9zIQ2ZNo25sMyXnbh32h+P1ezDsUpUH3JAew==",
13835
+      "dependencies": {
13836
+        "react-is": "^16.3.2",
13837
+        "warning": "^4.0.0"
13838
+      },
13839
+      "peerDependencies": {
13840
+        "react": ">=0.14.0"
13841
+      }
13842
+    },
13843
+    "node_modules/prop-types-extra/node_modules/react-is": {
13844
+      "version": "16.13.1",
13845
+      "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
13846
+      "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
13847
+    },
13717 13848
     "node_modules/prop-types/node_modules/react-is": {
13718 13849
       "version": "16.13.1",
13719 13850
       "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -13910,6 +14041,35 @@
13910 14041
         "node": ">=14"
13911 14042
       }
13912 14043
     },
14044
+    "node_modules/react-bootstrap": {
14045
+      "version": "2.7.0",
14046
+      "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-2.7.0.tgz",
14047
+      "integrity": "sha512-Jcrn6aUuRVBeSB6dzKODKZU1TONOdhAxu0IDm4Sv74SJUm98dMdhSotF2SNvFEADANoR+stV+7TK6SNX1wWu5w==",
14048
+      "dependencies": {
14049
+        "@babel/runtime": "^7.17.2",
14050
+        "@restart/hooks": "^0.4.6",
14051
+        "@restart/ui": "^1.4.1",
14052
+        "@types/react-transition-group": "^4.4.4",
14053
+        "classnames": "^2.3.1",
14054
+        "dom-helpers": "^5.2.1",
14055
+        "invariant": "^2.2.4",
14056
+        "prop-types": "^15.8.1",
14057
+        "prop-types-extra": "^1.1.0",
14058
+        "react-transition-group": "^4.4.2",
14059
+        "uncontrollable": "^7.2.1",
14060
+        "warning": "^4.0.3"
14061
+      },
14062
+      "peerDependencies": {
14063
+        "@types/react": ">=16.14.8",
14064
+        "react": ">=16.14.0",
14065
+        "react-dom": ">=16.14.0"
14066
+      },
14067
+      "peerDependenciesMeta": {
14068
+        "@types/react": {
14069
+          "optional": true
14070
+        }
14071
+      }
14072
+    },
13913 14073
     "node_modules/react-dev-utils": {
13914 14074
       "version": "12.0.1",
13915 14075
       "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
@@ -13977,6 +14137,11 @@
13977 14137
       "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
13978 14138
       "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
13979 14139
     },
14140
+    "node_modules/react-lifecycles-compat": {
14141
+      "version": "3.0.4",
14142
+      "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
14143
+      "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
14144
+    },
13980 14145
     "node_modules/react-refresh": {
13981 14146
       "version": "0.11.0",
13982 14147
       "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
@@ -14100,6 +14265,21 @@
14100 14265
         }
14101 14266
       }
14102 14267
     },
14268
+    "node_modules/react-transition-group": {
14269
+      "version": "4.4.5",
14270
+      "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
14271
+      "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==",
14272
+      "dependencies": {
14273
+        "@babel/runtime": "^7.5.5",
14274
+        "dom-helpers": "^5.0.1",
14275
+        "loose-envify": "^1.4.0",
14276
+        "prop-types": "^15.6.2"
14277
+      },
14278
+      "peerDependencies": {
14279
+        "react": ">=16.6.0",
14280
+        "react-dom": ">=16.6.0"
14281
+      }
14282
+    },
14103 14283
     "node_modules/read-cache": {
14104 14284
       "version": "1.0.0",
14105 14285
       "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@@ -15981,6 +16161,20 @@
15981 16161
         "url": "https://github.com/sponsors/ljharb"
15982 16162
       }
15983 16163
     },
16164
+    "node_modules/uncontrollable": {
16165
+      "version": "7.2.1",
16166
+      "resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-7.2.1.tgz",
16167
+      "integrity": "sha512-svtcfoTADIB0nT9nltgjujTi7BzVmwjZClOmskKu/E8FW9BXzg9os8OLr4f8Dlnk0rYWJIWr4wv9eKUXiQvQwQ==",
16168
+      "dependencies": {
16169
+        "@babel/runtime": "^7.6.3",
16170
+        "@types/react": ">=16.9.11",
16171
+        "invariant": "^2.2.4",
16172
+        "react-lifecycles-compat": "^3.0.4"
16173
+      },
16174
+      "peerDependencies": {
16175
+        "react": ">=15.0.0"
16176
+      }
16177
+    },
15984 16178
     "node_modules/unicode-canonical-property-names-ecmascript": {
15985 16179
       "version": "2.0.0",
15986 16180
       "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz",
@@ -16225,6 +16419,14 @@
16225 16419
         "makeerror": "1.0.12"
16226 16420
       }
16227 16421
     },
16422
+    "node_modules/warning": {
16423
+      "version": "4.0.3",
16424
+      "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
16425
+      "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",
16426
+      "dependencies": {
16427
+        "loose-envify": "^1.0.0"
16428
+      }
16429
+    },
16228 16430
     "node_modules/watchpack": {
16229 16431
       "version": "2.4.0",
16230 16432
       "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",

+ 2
- 0
package.json 查看文件

@@ -19,9 +19,11 @@
19 19
     "@types/react-dom": "^18.0.6",
20 20
     "@types/react-router": "^5.1.11",
21 21
     "@types/react-router-dom": "^5.1.7",
22
+    "bootstrap": "^5.2.3",
22 23
     "history": "^4.9.0",
23 24
     "ionicons": "^6.0.3",
24 25
     "react": "^18.2.0",
26
+    "react-bootstrap": "^2.7.0",
25 27
     "react-dom": "^18.2.0",
26 28
     "react-router": "^5.2.0",
27 29
     "react-router-dom": "^5.2.0",

+ 15
- 0
src/components/QuizForm.tsx 查看文件

@@ -0,0 +1,15 @@
1
+import React, {useState} from 'react';
2
+import { IonRadioGroup, IonRadio, IonLabel } from '@ionic/react';
3
+
4
+const GenderForm: React.FC = () => {
5
+  const [gender, setGender] = useState('');
6
+
7
+  const handleSubmit = (event: React.FormEvent) => {
8
+    event.preventDefault();
9
+    // Perform form submission here
10
+  };
11
+
12
+  return (
13
+    null
14
+  );
15
+};

+ 75
- 0
src/data/Quizzes.json 查看文件

@@ -0,0 +1,75 @@
1
+[
2
+    {
3
+        "id": 1,
4
+        "title": "Roberto Clemente",
5
+        "pregunta-1": "¿En que año nació Roberto Clemente?",
6
+        "res-1-1":"1934",
7
+        "res-1-2":"1950",
8
+        "res-1-3":"1943",
9
+        "res-1-4":"2022",
10
+        "pregunta-2": "¿En que pueblo se crió?",
11
+        "res-2-1":"Caguas",
12
+        "res-2-2":"Cabo Rojo",
13
+        "res-2-3":"Luquillo",
14
+        "res-2-4":"Carolina",
15
+        "pregunta-3": "¿Para qué equipo de la liga de beisbol profesional de Puerto Rico jugó?",
16
+        "res-3-1":"Bacalaos de Fajardo",
17
+        "res-3-2":"Alcapurrias de Loiza",
18
+        "res-3-3":"Cangrejeros de Santurce",
19
+        "res-3-4":"Brujos de Guayama",
20
+        "pregunta-4": "¿Para que equipo de la MLB jugó?",
21
+        "res-4-1":"New York Yankees",
22
+        "res-4-2":"Houston Astros",
23
+        "res-4-3":"Chicago Cubs",
24
+        "res-4-4":"Pittsburgh Pirates"
25
+    },
26
+    {
27
+        "id":2,
28
+        "title": "Marian Villaronga Toro",
29
+        "pregunta-1": "¿En que año nació Marian Villaronga Toro1?",
30
+        "res-1-1":"11",
31
+        "res-1-2":"12",
32
+        "res-1-3":"13",
33
+        "res-1-4":"14",
34
+        "pregunta-2": "¿En que año nació Marian Villaronga Toro2?",
35
+        "res-2-1":"21",
36
+        "res-2-2":"22",
37
+        "res-2-3":"23",
38
+        "res-2-4":"24",
39
+        "pregunta-3": "¿En que año nació Marian Villaronga Toro3",
40
+        "res-3-1":"31",
41
+        "res-3-2":"32",
42
+        "res-3-3":"33",
43
+        "res-3-4":"34",
44
+        "pregunta-4": "¿En que año nació Marian Villaronga Toro4",
45
+        "res-4-1":"41",
46
+        "res-4-2":"42",
47
+        "res-4-3":"43",
48
+        "res-4-4":"44"
49
+    }
50
+    ,
51
+    {
52
+        "id":3,
53
+        "title": "German Rieckhoff Sampoyo",
54
+        "pregunta-1": "¿En que año nació German Rieckhoff Sampoyo1?",
55
+        "res-1-1":"11",
56
+        "res-1-2":"12",
57
+        "res-1-3":"13",
58
+        "res-1-4":"14",
59
+        "pregunta-2": "¿En que año nació German Rieckhoff Sampoyo2?",
60
+        "res-2-1":"21",
61
+        "res-2-2":"22",
62
+        "res-2-3":"23",
63
+        "res-2-4":"24",
64
+        "pregunta-3": "¿En que año nació German Rieckhoff Sampoyo3?",
65
+        "res-3-1":"31",
66
+        "res-3-2":"32",
67
+        "res-3-3":"33",
68
+        "res-3-4":"34",
69
+        "pregunta-4": "¿En que año nació German Rieckhoff Sampoyo4?",
70
+        "res-4-1":"41",
71
+        "res-4-2":"42",
72
+        "res-4-3":"43",
73
+        "res-4-4":"44"
74
+    }
75
+]

+ 20
- 0
src/pages/Questions.css 查看文件

@@ -11,4 +11,24 @@ ion-grid {
11 11
 ion-col {
12 12
     text-align: center;
13 13
     align-items: center;
14
+}
15
+
16
+ion-radio {
17
+    --border-radius: 4px;
18
+    --inner-border-radius: 4px;
19
+  
20
+    --color: rgb(110, 110, 110);
21
+    --color-checked: #5abae0;
22
+}
23
+
24
+ion-radio.ios {
25
+    width: 20px;
26
+    height: 20px;
27
+
28
+    border: 2px solid rgb(110, 110, 110);
29
+    border-radius: 4px;
30
+}
31
+
32
+.radio-checked.ios {
33
+    border-color: #5abae0;
14 34
 }

+ 160
- 128
src/pages/Questions.tsx 查看文件

@@ -12,7 +12,6 @@ import {
12 12
     IonItem,
13 13
     IonLabel,
14 14
     IonList,
15
-    IonCheckbox,
16 15
     IonCard,
17 16
     IonCardContent,
18 17
     IonCardHeader,
@@ -21,16 +20,31 @@ import {
21 20
     IonButton,
22 21
     IonGrid,
23 22
     IonRow,
24
-    IonCol
23
+    IonCol,
24
+    IonRadioGroup,
25
+    IonRadio
25 26
 } from '@ionic/react';
26 27
 import { arrowBack } from 'ionicons/icons';
27
-import React from 'react';
28
+import React, {useState} from 'react';
29
+//import { Form } from 'react-bootstrap';
28 30
 import './Questions.css';
29 31
 import Biography from './Biography';
30 32
 import EnciclopediaPR from '../assets/EnciclopediaPR.png';
31 33
 import RobertoClemente from '../assets/RobertoClemente.jpg';
34
+import Quizzes from '../data/Quizzes.json';
35
+
32 36
 
33 37
 const Questions: React.FC = () => {
38
+
39
+    const [res1, setRes1] = useState();
40
+    const [res2, setRes2] = useState();
41
+    const [res3, setRes3] = useState();
42
+    const [res4, setRes4] = useState();
43
+
44
+    const verificarRes = () => {
45
+        return console.log([res1, res2, res3, res4])
46
+    };
47
+
34 48
     return (
35 49
         <IonPage>
36 50
             <IonHeader>
@@ -50,131 +64,149 @@ const Questions: React.FC = () => {
50 64
 
51 65
             <IonContent fullscreen className="ion-padding">
52 66
                 <IonImg style={{ height: 300, width: 600 }} src={RobertoClemente} alt='Logo'></IonImg>
53
-                <h1>Quiz sobre la biografia de Roberto Clemente</h1>
54
-
55
-                <p>Marque una respuesta por pregunta</p>
56
-
57
-                <IonCard>
58
-                    <IonCardHeader>
59
-                        <IonCardTitle>¿En que año nació Roberto Clemente?</IonCardTitle>
60
-                        <IonCardSubtitle></IonCardSubtitle>
61
-                    </IonCardHeader>
62
-                    <IonCardContent>
63
-                        <IonList>
64
-                            <IonItem>
65
-                                <IonCheckbox slot="start"></IonCheckbox>
66
-                                <IonLabel>1934</IonLabel>
67
-                            </IonItem>
68
-
69
-                            <IonItem>
70
-                                <IonCheckbox slot="start"></IonCheckbox>
71
-                                <IonLabel>1950</IonLabel>
72
-                            </IonItem>
73
-
74
-                            <IonItem>
75
-                                <IonCheckbox slot="start"></IonCheckbox>
76
-                                <IonLabel>1943</IonLabel>
77
-                            </IonItem>
78
-
79
-                            <IonItem>
80
-                                <IonCheckbox slot="start"></IonCheckbox>
81
-                                <IonLabel>2022</IonLabel>
82
-                            </IonItem>
83
-                        </IonList>
84
-                    </IonCardContent>
85
-                </IonCard>
86
-
87
-                <IonCard>
88
-                    <IonCardHeader>
89
-                        <IonCardTitle>¿En que pueblo se crió?</IonCardTitle>
90
-
91
-                    </IonCardHeader>
92
-                    <IonCardContent>
93
-                        <IonList>
94
-                            <IonItem>
95
-                                <IonCheckbox slot="start"></IonCheckbox>
96
-                                <IonLabel>Caguas</IonLabel>
97
-                            </IonItem>
98
-
99
-                            <IonItem>
100
-                                <IonCheckbox slot="start"></IonCheckbox>
101
-                                <IonLabel>Cabo Rojo</IonLabel>
102
-                            </IonItem>
103
-
104
-                            <IonItem>
105
-                                <IonCheckbox slot="start"></IonCheckbox>
106
-                                <IonLabel>Luquillo</IonLabel>
107
-                            </IonItem>
108
-
109
-                            <IonItem>
110
-                                <IonCheckbox slot="start"></IonCheckbox>
111
-                                <IonLabel>Carolina</IonLabel>
112
-                            </IonItem>
113
-                        </IonList>
114
-                    </IonCardContent>
115
-                </IonCard>
116
-
117
-                <IonCard>
118
-                    <IonCardHeader>
119
-                        <IonCardTitle>¿Para qué equipo de la liga de beisbol profesional de Puerto Rico jugó?</IonCardTitle>
120
-
121
-                    </IonCardHeader>
122
-                    <IonCardContent>
123
-                        <IonList>
124
-                            <IonItem>
125
-                                <IonCheckbox slot="start"></IonCheckbox>
126
-                                <IonLabel>Bacalaos de Fajardo</IonLabel>
127
-                            </IonItem>
128
-
129
-                            <IonItem>
130
-                                <IonCheckbox slot="start"></IonCheckbox>
131
-                                <IonLabel>Alcapurrias de Loiza</IonLabel>
132
-                            </IonItem>
133
-
134
-                            <IonItem>
135
-                                <IonCheckbox slot="start"></IonCheckbox>
136
-                                <IonLabel>Cangrejeros de Santurce</IonLabel>
137
-                            </IonItem>
138
-
139
-                            <IonItem>
140
-                                <IonCheckbox slot="start"></IonCheckbox>
141
-                                <IonLabel>Brujos de Guayama</IonLabel>
142
-                            </IonItem>
143
-                        </IonList>
144
-                    </IonCardContent>
145
-                </IonCard>
146
-
147
-                <IonCard>
148
-                    <IonCardHeader>
149
-                        <IonCardTitle>¿Para que equipo de la MLB jugó?</IonCardTitle>
150
-
151
-                    </IonCardHeader>
152
-                    <IonCardContent>
153
-                        <IonList>
154
-                            <IonItem>
155
-                                <IonCheckbox slot="start"></IonCheckbox>
156
-                                <IonLabel>New York Yankees</IonLabel>
157
-                            </IonItem>
158
-
159
-                            <IonItem>
160
-                                <IonCheckbox slot="start"></IonCheckbox>
161
-                                <IonLabel>Houston Astros</IonLabel>
162
-                            </IonItem>
163
-
164
-                            <IonItem>
165
-                                <IonCheckbox slot="start"></IonCheckbox>
166
-                                <IonLabel>Chicago Cubs</IonLabel>
167
-                            </IonItem>
168
-
169
-                            <IonItem>
170
-                                <IonCheckbox slot="start"></IonCheckbox>
171
-                                <IonLabel>Pittsburgh Pirates</IonLabel>
172
-                            </IonItem>
173
-                        </IonList>
174
-                    </IonCardContent>
175
-                </IonCard>
176
-
177
-                <IonButton>Verificar respuestas</IonButton>
67
+
68
+                {
69
+                    Quizzes && Quizzes.map(quizzes => {
70
+                        return (
71
+                        quizzes.id == 1 ? <>
72
+                        <h1>Quiz sobre la biografia de {quizzes.title}</h1>
73
+
74
+                        <p>Marque una respuesta por pregunta</p>
75
+
76
+                        <IonCard>
77
+                            <IonCardHeader>
78
+                                <IonCardTitle>{quizzes['pregunta-1']}</IonCardTitle>
79
+                                <IonCardSubtitle></IonCardSubtitle>
80
+                            </IonCardHeader>
81
+                            <IonCardContent>
82
+                                <IonList>
83
+                                    <IonRadioGroup value={res1} onIonChange={(e) => setRes1(e.detail.value)}>
84
+                                        <IonItem>
85
+                                            <IonLabel>{quizzes['res-1-1']}</IonLabel>
86
+                                            <IonRadio slot="end" value={quizzes['res-1-1']}></IonRadio>
87
+                                        </IonItem>
88
+
89
+                                        <IonItem>
90
+                                            <IonLabel>{quizzes['res-1-2']}</IonLabel>
91
+                                            <IonRadio slot="end" value={quizzes['res-1-2']}></IonRadio>
92
+                                        </IonItem>
93
+
94
+                                        <IonItem>
95
+                                            <IonLabel>{quizzes['res-1-3']}</IonLabel>
96
+                                            <IonRadio slot="end" value={quizzes['res-1-3']}></IonRadio>
97
+                                        </IonItem>
98
+
99
+                                        <IonItem>
100
+                                            <IonLabel>{quizzes['res-1-4']}</IonLabel>
101
+                                            <IonRadio slot="end" value={quizzes['res-1-4']}></IonRadio>
102
+                                        </IonItem>
103
+                                    </IonRadioGroup>
104
+                                </IonList>
105
+                            </IonCardContent>
106
+                        </IonCard>
107
+
108
+                        <IonCard>
109
+                            <IonCardHeader>
110
+                                <IonCardTitle>{quizzes['pregunta-2']}</IonCardTitle>
111
+                                <IonCardSubtitle></IonCardSubtitle>
112
+                            </IonCardHeader>
113
+                            <IonCardContent>
114
+                                <IonList>
115
+                                    <IonRadioGroup value={res2} onIonChange={(e) => setRes2(e.detail.value)}>
116
+                                        <IonItem>
117
+                                            <IonLabel>{quizzes['res-2-1']}</IonLabel>
118
+                                            <IonRadio slot="end" value={quizzes['res-2-1']}></IonRadio>
119
+                                        </IonItem>
120
+
121
+                                        <IonItem>
122
+                                            <IonLabel>{quizzes['res-2-2']}</IonLabel>
123
+                                            <IonRadio slot="end" value={quizzes['res-2-2']}></IonRadio>
124
+                                        </IonItem>
125
+
126
+                                        <IonItem>
127
+                                            <IonLabel>{quizzes['res-2-3']}</IonLabel>
128
+                                            <IonRadio slot="end" value={quizzes['res-2-3']}></IonRadio>
129
+                                        </IonItem>
130
+
131
+                                        <IonItem>
132
+                                            <IonLabel>{quizzes['res-2-4']}</IonLabel>
133
+                                            <IonRadio slot="end" value={quizzes['res-2-4']}></IonRadio>
134
+                                        </IonItem>
135
+                                    </IonRadioGroup>
136
+                                </IonList>
137
+                            </IonCardContent>
138
+                        </IonCard>
139
+
140
+                        <IonCard>
141
+                            <IonCardHeader>
142
+                                <IonCardTitle>{quizzes['pregunta-3']}</IonCardTitle>
143
+                                <IonCardSubtitle></IonCardSubtitle>
144
+                            </IonCardHeader>
145
+                            <IonCardContent>
146
+                                <IonList>
147
+                                    <IonRadioGroup value={res3} onIonChange={(e) => setRes3(e.detail.value)}>
148
+                                        <IonItem>
149
+                                            <IonLabel>{quizzes['res-3-1']}</IonLabel>
150
+                                            <IonRadio slot="end" value={quizzes['res-3-1']}></IonRadio>
151
+                                        </IonItem>
152
+
153
+                                        <IonItem>
154
+                                            <IonLabel>{quizzes['res-3-2']}</IonLabel>
155
+                                            <IonRadio slot="end" value={quizzes['res-3-2']}></IonRadio>
156
+                                        </IonItem>
157
+
158
+                                        <IonItem>
159
+                                            <IonLabel>{quizzes['res-3-3']}</IonLabel>
160
+                                            <IonRadio slot="end" value={quizzes['res-3-3']}></IonRadio>
161
+                                        </IonItem>
162
+
163
+                                        <IonItem>
164
+                                            <IonLabel>{quizzes['res-3-4']}</IonLabel>
165
+                                            <IonRadio slot="end" value={quizzes['res-3-4']}></IonRadio>
166
+                                        </IonItem>
167
+                                    </IonRadioGroup>
168
+                                </IonList>
169
+                            </IonCardContent>
170
+                        </IonCard>
171
+
172
+                        <IonCard>
173
+                            <IonCardHeader>
174
+                                <IonCardTitle>{quizzes['pregunta-4']}</IonCardTitle>
175
+                                <IonCardSubtitle></IonCardSubtitle>
176
+                            </IonCardHeader>
177
+                            <IonCardContent>
178
+                                <IonList>
179
+                                    <IonRadioGroup value={res4} onIonChange={(e) => setRes4(e.detail.value)}>
180
+                                        <IonItem>
181
+                                            <IonLabel>{quizzes['res-4-1']}</IonLabel>
182
+                                            <IonRadio slot="end" value={quizzes['res-4-1']}></IonRadio>
183
+                                        </IonItem>
184
+
185
+                                        <IonItem>
186
+                                            <IonLabel>{quizzes['res-4-2']}</IonLabel>
187
+                                            <IonRadio slot="end" value={quizzes['res-4-2']}></IonRadio>
188
+                                        </IonItem>
189
+
190
+                                        <IonItem>
191
+                                            <IonLabel>{quizzes['res-4-3']}</IonLabel>
192
+                                            <IonRadio slot="end" value={quizzes['res-4-3']}></IonRadio>
193
+                                        </IonItem>
194
+
195
+                                        <IonItem>
196
+                                            <IonLabel>{quizzes['res-4-4']}</IonLabel>
197
+                                            <IonRadio slot="end" value={quizzes['res-4-4']}></IonRadio>
198
+                                        </IonItem>
199
+                                    </IonRadioGroup>
200
+                                </IonList>
201
+                            </IonCardContent>
202
+                        </IonCard>
203
+                    </> : null
204
+                        )
205
+                    })
206
+                }
207
+
208
+
209
+                <IonButton onClick={verificarRes}>Verificar respuestas</IonButton>
178 210
 
179 211
             </IonContent>
180 212