2023-01-23 19:04:05 -08:00
|
|
|
import Decimal from 'decimal.js'
|
2022-10-05 16:03:10 -07:00
|
|
|
import { LinkButton } from './Button'
|
2023-01-23 19:04:05 -08:00
|
|
|
import FormatNumericValue from './FormatNumericValue'
|
2022-10-05 16:03:10 -07:00
|
|
|
|
|
|
|
const MaxAmountButton = ({
|
|
|
|
className,
|
2023-01-23 19:04:05 -08:00
|
|
|
decimals,
|
2022-11-16 19:51:08 -08:00
|
|
|
disabled,
|
2022-10-05 16:03:10 -07:00
|
|
|
label,
|
|
|
|
onClick,
|
|
|
|
value,
|
|
|
|
}: {
|
2022-11-01 21:41:12 -07:00
|
|
|
className?: string
|
2023-11-27 03:33:33 -08:00
|
|
|
decimals?: number
|
2022-11-16 19:51:08 -08:00
|
|
|
disabled?: boolean
|
2022-10-05 16:03:10 -07:00
|
|
|
label: string
|
|
|
|
onClick: () => void
|
2023-01-23 19:04:05 -08:00
|
|
|
value: number | string | Decimal
|
2022-10-05 16:03:10 -07:00
|
|
|
}) => {
|
|
|
|
return (
|
2022-11-16 19:51:08 -08:00
|
|
|
<LinkButton
|
2023-04-20 19:32:20 -07:00
|
|
|
className={`font-normal ${className}`}
|
2022-11-16 19:51:08 -08:00
|
|
|
disabled={disabled}
|
|
|
|
onClick={onClick}
|
|
|
|
>
|
2022-12-13 15:16:50 -08:00
|
|
|
<p className="mr-1 text-th-fgd-4">{label}:</p>
|
2023-03-24 05:22:29 -07:00
|
|
|
<span className="font-mono">
|
2023-01-23 19:04:05 -08:00
|
|
|
<FormatNumericValue value={value} decimals={decimals} />
|
|
|
|
</span>
|
2022-10-05 16:03:10 -07:00
|
|
|
</LinkButton>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MaxAmountButton
|