Skip to content

Commit

Permalink
simplify code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharqiewicz committed May 31, 2024
1 parent 82efa84 commit e22bc45
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions src/components/Form/Amount/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,23 @@ const Amount = ({
/>
</div>
<div className="flex">
{hideHalfButton ? (
<></>
) : (
<>
<button
className="text-accent-content underline hover:opacity-70 mx-1 font-semibold"
onClick={() => setValue(roundNumber(Number(max) * 0.5))}
type="button"
>
50%
</button>
</>
{hideHalfButton ? null : (
<button
className="text-accent-content underline hover:opacity-70 mx-1 font-semibold"
onClick={() => setValue(roundNumber(Number(max) * 0.5))}
type="button"
>
50%
</button>
)}
{hideMaxButton ? (
<></>
) : (
<>
<button
className="text-accent-content underline hover:opacity-70 mx-1 font-semibold"
onClick={() => setValue(calculateMaxAmount(Number(max), fullMax))}
type="button"
>
MAX
</button>
</>
{hideMaxButton ? null : (
<button
className="text-accent-content underline hover:opacity-70 mx-1 font-semibold"
onClick={() => setValue(calculateMaxAmount(Number(max), fullMax))}
type="button"
>
MAX
</button>
)}
</div>
</div>
Expand Down

0 comments on commit e22bc45

Please sign in to comment.