From 156bc7c658ab56f6607189e3f5cba66d00a90802 Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Mon, 16 Nov 2020 19:15:54 -0500 Subject: move all calculation logic into MainPage --- src/Card.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/Card.js') diff --git a/src/Card.js b/src/Card.js index a296681..cac335c 100644 --- a/src/Card.js +++ b/src/Card.js @@ -3,21 +3,20 @@ import { Link } from "react-router-dom"; import "./Card.css"; const Card = (props) => { - let diff = props.latest - props.prior; - if (diff >= 0) { - diff = "+" + diff.toString(); + let diff = props.diff.toString(); + if (diff.charAt(0) != "-") { + diff = "+" + diff; } + return (

- {props.latest} - {props.suffix}{" "} + {props.latest}{" "} - ({diff} - {props.suffix}) + ({diff})

{props.name}

-- cgit v1.2.3