Merge branch 'v2.0.5' of https://github.com/mars-protocol/mars-v2-frontend into develop
This commit is contained in:
commit
90d06932fc
@ -1,5 +1,5 @@
|
|||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { ChangeEvent, useRef, useState } from 'react'
|
import { ChangeEvent, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import Draggable from 'react-draggable'
|
import Draggable from 'react-draggable'
|
||||||
|
|
||||||
import { OverlayMark } from 'components/Icons'
|
import { OverlayMark } from 'components/Icons'
|
||||||
@ -98,6 +98,17 @@ export default function Slider(props: Props) {
|
|||||||
|
|
||||||
const DraggableElement: any = Draggable
|
const DraggableElement: any = Draggable
|
||||||
|
|
||||||
|
const [positionOffset, position] = useMemo(() => {
|
||||||
|
return [
|
||||||
|
{ x: (props.value / 100) * -12, y: 0 },
|
||||||
|
{ x: (sliderRect.width / 100) * props.value, y: -2 },
|
||||||
|
]
|
||||||
|
}, [props.value, sliderRect.width])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleSliderRect()
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
@ -164,10 +175,10 @@ export default function Slider(props: Props) {
|
|||||||
axis='x'
|
axis='x'
|
||||||
grid={[sliderRect.width / 100, 0]}
|
grid={[sliderRect.width / 100, 0]}
|
||||||
bounds={{ left: 0, right: sliderRect.width }}
|
bounds={{ left: 0, right: sliderRect.width }}
|
||||||
positionOffset={{ x: (props.value / 100) * -12, y: 0 }}
|
positionOffset={positionOffset}
|
||||||
onDrag={handleDrag}
|
onDrag={handleDrag}
|
||||||
onStop={() => setIsDragging(false)}
|
onStop={() => setIsDragging(false)}
|
||||||
position={{ x: (sliderRect.width / 100) * props.value, y: -2 }}
|
position={position}
|
||||||
>
|
>
|
||||||
<div ref={nodeRef} className='absolute z-20 leading-3'>
|
<div ref={nodeRef} className='absolute z-20 leading-3'>
|
||||||
<div
|
<div
|
||||||
@ -202,7 +213,7 @@ export default function Slider(props: Props) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{props.leverage && (
|
{props.leverage && (
|
||||||
<div className='pt-2 flex justify-between'>
|
<div className='flex justify-between pt-2'>
|
||||||
<LeverageLabel
|
<LeverageLabel
|
||||||
leverage={1}
|
leverage={1}
|
||||||
decimals={0}
|
decimals={0}
|
||||||
|
Loading…
Reference in New Issue
Block a user