From edf3ec383df2f06fbb98cfe5a8b2bfea61c81fd0 Mon Sep 17 00:00:00 2001 From: "vianney.jourdy" Date: Thu, 6 Feb 2025 09:47:16 +0100 Subject: [PATCH] add sport question --- app/(quiz)/quiz.tsx | 2 + components/CheckButtonComponent.tsx | 66 +++++++++++++++++++++++------ components/quiz/SportQuestion.tsx | 20 ++++----- 3 files changed, 64 insertions(+), 24 deletions(-) diff --git a/app/(quiz)/quiz.tsx b/app/(quiz)/quiz.tsx index 16501db..41f80ac 100644 --- a/app/(quiz)/quiz.tsx +++ b/app/(quiz)/quiz.tsx @@ -14,6 +14,7 @@ import AgeQuestion from "@/components/quiz/AgeQuestion"; import BeginnerQuestion from "@/components/quiz/BeginnerQuestion"; import LvlQuestion from "@/components/quiz/LvlQuestion"; import SleepQuestion from "@/components/quiz/SleepQuestion"; +import SportQuestion from "@/components/quiz/SportQuestion"; export default function Quiz() { const [currentQuestionIndex, setCurrentQuestionIndex] = React.useState(0); @@ -30,6 +31,7 @@ export default function Quiz() { { component: BeginnerQuestion, props: {} }, { component: LvlQuestion, props: {} }, { component: FrequencyQuestion, props: { isMale: true } }, + { component: SportQuestion, props: {} }, { component: SleepQuestion, props: {} }, ]; diff --git a/components/CheckButtonComponent.tsx b/components/CheckButtonComponent.tsx index 97007f4..0340f2c 100644 --- a/components/CheckButtonComponent.tsx +++ b/components/CheckButtonComponent.tsx @@ -1,29 +1,67 @@ import React, {Component} from "react"; import {View, Text, TouchableOpacity, Image} from "react-native"; -import {AntDesign, FontAwesome6} from "@expo/vector-icons"; -import {AntDesignIconNames} from "./Icons"; +import { + AntDesign, + Entypo, + FontAwesome6, + MaterialCommunityIcons, +} from "@expo/vector-icons"; +import { + AntDesignIconNames, + CommunityIconNames, + EntypoIconNames, + FontAwesomeIconNames, +} from "./Icons"; interface CheckButtonProps { label: string; value: boolean; onChange: () => void; - icon: AntDesignIconNames | string; + antIcon?: AntDesignIconNames; + entypoIcon?: EntypoIconNames; + fontAwesomeIcon?: FontAwesomeIconNames; + communityIcon?: CommunityIconNames; } -const CheckButton: React.FC = ({ label, value, onChange, icon }) => { - let AwesomIconList = ["weight-scale", "beer"]; +const CheckButton: React.FC = ({ label, value, onChange, antIcon, + entypoIcon, + fontAwesomeIcon, + communityIcon, }) => { return ( - - - {AwesomIconList.includes(icon) ? ( - - ) : ( - - )} - + + + {antIcon ? ( + + ) : null} + {entypoIcon ? ( + + ) : null} + {communityIcon ? ( + + ) : null} + {fontAwesomeIcon ? ( + + ) : null} - {label} + {label} + ); }; diff --git a/components/quiz/SportQuestion.tsx b/components/quiz/SportQuestion.tsx index 4cb1dd1..9dbd409 100644 --- a/components/quiz/SportQuestion.tsx +++ b/components/quiz/SportQuestion.tsx @@ -141,18 +141,18 @@ export default React.forwardRef( {...ref} {...rest} > - - - - + + + + - - - + + + - - - + + + );