import classNames from 'classnames' import { VerticalThreeLine } from 'components/common/Icons' import { LeverageSliderType } from 'components/common/LeverageSlider' import { formatValue } from 'utils/formatters' interface Props { value: number marginThreshold?: number max: number type: LeverageSliderType min: number } const THUMB_WIDTH = 33 function InputOverlay({ max, value, marginThreshold, type, min }: Props) { const thumbPosPercent = max === 0 ? 0 : 100 / ((max - min) / (value - min)) const thumbPadRight = (thumbPosPercent / 100) * THUMB_WIDTH const markPosPercent = 100 / (max / (marginThreshold ?? 1)) const markPadRight = (markPosPercent / 100) * THUMB_WIDTH const hasPastMarginThreshold = marginThreshold ? value >= marginThreshold : undefined console.log(max, value) return ( <>
{Array.from(Array(9).keys()).map((i) => (
))} {marginThreshold !== undefined && (
Margin
)}
{formatValue(value, { minDecimals: type !== 'margin' ? 1 : 2, maxDecimals: type !== 'margin' ? 1 : 2, abbreviated: true, rounded: true, suffix: type !== 'margin' ? 'x' : '', })}
) } export default InputOverlay