diff options
Diffstat (limited to 'src/Card.js')
-rw-r--r-- | src/Card.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Card.js b/src/Card.js new file mode 100644 index 0000000..310848d --- /dev/null +++ b/src/Card.js @@ -0,0 +1,24 @@ +import React from "react"; +import "./Card.css"; + +const Card = (props) => { + let diff = props.latest - props.prior; + if (diff >= 0) { + diff = "+" + diff.toString(); + } + return ( + <div className="Card"> + <h3>{props.name}</h3> + <p> + {props.latest} + {props.suffix}{" "} + <span className="Diff"> + ({diff} + {props.suffix}) + </span> + </p> + </div> + ); +}; + +export default Card; |