From 42ae3ba990902b235e250de515b06a39a962775a Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 28 Sep 2023 18:06:32 -0700 Subject: [PATCH] added component --- components/ProfitDisplay.jsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 components/ProfitDisplay.jsx diff --git a/components/ProfitDisplay.jsx b/components/ProfitDisplay.jsx new file mode 100644 index 0000000..564ae81 --- /dev/null +++ b/components/ProfitDisplay.jsx @@ -0,0 +1,22 @@ +import { Typography } from '@mui/material' +import React from 'react' + +const ProfitDisplay = (props) => { + console.log(props.profit); + if (Number.isNaN(props.profit) || props.profit <= 0) { + return ( + + Please enter an investment amount + + ) + } else { + const formattedAmount = props.profit.toLocaleString('en-US', { style: 'currency', currency: 'USD' }); + return ( + + Your orignal investment would be {formattedAmount} today! + + ) + } +} + +export default ProfitDisplay \ No newline at end of file