mango-v4-ui/components/shared/MaxAmountButton.tsx

35 lines
754 B
TypeScript
Raw Normal View History

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-01-23 19:04:05 -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
2022-12-13 15:16:50 -08:00
className={`font-normal no-underline ${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-01-23 19:04:05 -08:00
<span className="font-mono text-th-fgd-2 underline">
<FormatNumericValue value={value} decimals={decimals} />
</span>
2022-10-05 16:03:10 -07:00
</LinkButton>
)
}
export default MaxAmountButton