Skip to content

Commit

Permalink
Formatting for if remaining budget is in the negative
Browse files Browse the repository at this point in the history
  • Loading branch information
chisPmama committed Feb 24, 2024
1 parent eb1fa5d commit 7fb9a10
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/components/Budget/Budget.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@
background: rgba(2, 177, 90, 0.15);
}

.budget-details-flex-neg {
display: flex;
width: 80px;
padding: 2px 0px;
justify-content: center;
align-items: center;
gap: 10px;
border-radius: 20px;
background: rgba(177, 2, 2, 0.15);
}

.budget-details-amount {
margin: 0px;
color: #02B15A;
Expand All @@ -132,6 +143,15 @@
line-height: normal;
}

.budget-details-amount-neg {
margin: 0px;
color: #b10202;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: normal;
}

.budget-categories-container {
display: flex;
flex-direction: column;
Expand Down
12 changes: 9 additions & 3 deletions src/components/Budget/Budget.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,15 @@ const Budget = () => {
</div>
<div className='budget-details'>
<h3 className='budget-details-h3'>Remaining Budget</h3>
<div className='budget-details-flex'>
<p className='budget-details-amount'>${(amountRemaining / 100).toFixed(2)}</p>
</div>
{(amountRemaining / 100).toFixed(2) < 0 ? (
<div className='budget-details-flex-neg'>
<p className='budget-details-amount-neg'>${(amountRemaining / 100).toFixed(2)}</p>
</div>
) : (
<div className='budget-details-flex'>
<p className='budget-details-amount'>${(amountRemaining / 100).toFixed(2)}</p>
</div>
)}
</div>
</section>
<section className='budget-categories-container'>
Expand Down

0 comments on commit 7fb9a10

Please sign in to comment.