added component
parent
87f558cf6d
commit
42ae3ba990
|
|
@ -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 (
|
||||
<Typography align='center' variant='h4'>
|
||||
Please enter an investment amount
|
||||
</Typography>
|
||||
)
|
||||
} else {
|
||||
const formattedAmount = props.profit.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
|
||||
return (
|
||||
<Typography align='center' variant='h4'>
|
||||
Your orignal investment would be {formattedAmount} today!
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ProfitDisplay
|
||||
Loading…
Reference in New Issue