From a6c5fb213387fffda5266b496caaadba65e5eec5 Mon Sep 17 00:00:00 2001 From: AndrewTrieu Date: Mon, 13 Mar 2023 16:15:28 +0200 Subject: [PATCH] Upload 1.10 --- part1/unicafe/src/App.js | 48 +++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/part1/unicafe/src/App.js b/part1/unicafe/src/App.js index ec579ed..264a2cd 100644 --- a/part1/unicafe/src/App.js +++ b/part1/unicafe/src/App.js @@ -1,22 +1,40 @@ import { useState } from "react"; +const Button = (props) => { + return ; +}; +const StatisticsLine = ({ text, value }) => { + return ( +

+ {" "} + {text} {value}{" "} +

+ ); +}; const Statistics = (props) => { if (props.good + props.neutral + props.bad === 0) { return

No feedback given

; } else { return (
-

good {props.good}

-

neutral {props.neutral}

-

bad {props.bad}

-

all {props.good + props.neutral + props.bad}

-

- average{" "} - {(props.good - props.bad) / (props.good + props.neutral + props.bad)} -

-

- positive{" "} - {(props.good / (props.good + props.neutral + props.bad)) * 100} % -

+ + + + + +
); } @@ -31,9 +49,9 @@ const App = () => {

give feedback

- - - +