From 7e9b95c8a3d572a916e437f25a9e8b1a956c7917 Mon Sep 17 00:00:00 2001 From: Thuan Bui Date: Thu, 26 Aug 2021 20:34:41 +0700 Subject: [PATCH] Completed 1.10 (unicafe step 5) --- part1/1.6-1.11-unicafe/src/App.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/part1/1.6-1.11-unicafe/src/App.js b/part1/1.6-1.11-unicafe/src/App.js index 4157bcb..df5f90f 100644 --- a/part1/1.6-1.11-unicafe/src/App.js +++ b/part1/1.6-1.11-unicafe/src/App.js @@ -11,7 +11,7 @@ const App = () => { const [good, neutral, bad] = props.data const all = good + bad + neutral const avg = (all !== 0) ? (good - bad) / all : 0 - const positive = (all !== 0) ? good/all*100 : "NA" + const positive = (all !== 0) ? good/all*100 + " %": "NA" return ( @@ -19,12 +19,13 @@ const App = () => {

Statistic

{all > 0 &&
-

Good: {good}

-

Neutral: {neutral}

-

Bad: {bad}

-

All: {all}

-

Average: {avg}

-

Positive: {positive} %

+ + + + + + +
} {all === 0 && "No feedback given"} @@ -32,13 +33,20 @@ const App = () => { ) } + const StatisticLine = (props) =>

{props.text}: {props.value}

+ + const Button = (props) => { + return ( + + ) + } + return (

Give feedback

- - - - +