From fe909323dcb1fa2f18cca97909c39923c0bd0bfc Mon Sep 17 00:00:00 2001 From: "vianney.jourdy" Date: Thu, 23 Jan 2025 17:21:04 +0100 Subject: [PATCH] modification des boutons --- components/CheckboxComponent.tsx | 26 ++++++++++++++++++++------ components/Icons.tsx | 2 +- components/quiz/GoalQuestion.tsx | 11 ++++++----- components/quiz/Question.tsx | 2 +- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/components/CheckboxComponent.tsx b/components/CheckboxComponent.tsx index 46e563c..bd78bae 100644 --- a/components/CheckboxComponent.tsx +++ b/components/CheckboxComponent.tsx @@ -1,19 +1,33 @@ -import React from "react"; -import { View, Text, TouchableOpacity } from "react-native"; +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 PropTypes, {string} from "prop-types"; interface CheckBoxProps { label: string; value: boolean; onChange: () => void; + icon: AntDesignIconNames | string; } -const CheckBox: React.FC = ({ label, value, onChange }) => { +const CheckBox: React.FC = ({ label, value, onChange, icon }) => { + let AwesomIconList = ["weight-scale", "beer"]; return ( - + + + {AwesomIconList.includes(icon) ? ( + + ) : ( + + )} + + + {label} + - {value && } + {value && } - {label} ); }; diff --git a/components/Icons.tsx b/components/Icons.tsx index c00ea36..22831ae 100644 --- a/components/Icons.tsx +++ b/components/Icons.tsx @@ -1,3 +1,3 @@ import { AntDesign } from "@expo/vector-icons"; -export type AntDesignIconNames = keyof typeof AntDesign.glyphMap; +export type AntDesignIconNames = keyof typeof AntDesign.glyphMap; \ No newline at end of file diff --git a/components/quiz/GoalQuestion.tsx b/components/quiz/GoalQuestion.tsx index b5f4dbc..83a00e3 100644 --- a/components/quiz/GoalQuestion.tsx +++ b/components/quiz/GoalQuestion.tsx @@ -2,6 +2,7 @@ import React from "react"; import Question, { QuestionChildProps } from "./Question"; import Checkbox from "../CheckboxComponent"; import {View} from "react-native"; +import {FontAwesome6} from "@expo/vector-icons"; export default React.forwardRef( (props, ref): React.ReactElement => { @@ -35,11 +36,11 @@ export default React.forwardRef( {...rest} > - - - - - + + + + + ); diff --git a/components/quiz/Question.tsx b/components/quiz/Question.tsx index e9bafe7..244e953 100644 --- a/components/quiz/Question.tsx +++ b/components/quiz/Question.tsx @@ -26,4 +26,4 @@ export default React.forwardRef( ); } -); +); \ No newline at end of file