From c73ae7e4ca95678f47d1a55d5293eed386a083f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20CHAUVIN?= Date: Tue, 13 Sep 2022 12:49:57 +0200 Subject: [PATCH] [ADD] optional title value --- front/components/progressBar.tsx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/front/components/progressBar.tsx b/front/components/progressBar.tsx index c5997df..d219c0a 100644 --- a/front/components/progressBar.tsx +++ b/front/components/progressBar.tsx @@ -1,20 +1,22 @@ import React from "react"; +import { View } from "react-native"; const ProgressBar = ( props: { progress: number; maxValue: number; barWidth: number; + title?: string; }) => { - const { progress, maxValue, barWidth } = props; + const { progress, maxValue, barWidth, title } = props; const containerStyles = { height: 20, width: `${barWidth}%`, backgroundColor: "#e0e0de", borderRadius: 50, - margin: 50 + margin: 20 } function computePercent(progress: number, maxValue: number) @@ -36,10 +38,24 @@ const ProgressBar = ( fontWeight: 'bold' } + if (title != null) { + // put the title in the middle TODO + return ( +
+
+ + {`${computePercent(progress, maxValue)}%`} + +
+
+ ); + } return (
- {`${computePercent(progress, maxValue)}%`} + + {`${computePercent(progress, maxValue)}%`} +
);