diff --git a/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx b/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx index 65ab607..9d0712c 100644 --- a/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx +++ b/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx @@ -5,7 +5,7 @@ import { clamp } from "lodash"; import { ProgressSliderBar, ProgressSliderBarHandle, ProgressSliderBarHandleContainer, ProgressSliderBody } from "./styles"; -const MARGIN_WIDTH = 30; +const MARGIN_WIDTH = 15; type ProgressSliderProps = { value: number, // Fraction of 1 (0.0 to 1.0) @@ -20,7 +20,7 @@ export function ProgressSlider({ const [bodyRef, { width: bodyWidth, }] = useMeasure(); - const barPos = useSpring({ x: (bodyWidth - 2 * MARGIN_WIDTH) * value }); + const barPos = useSpring({ x: (bodyWidth - MARGIN_WIDTH) * value }); const bindBarPos = useDrag((params) => { const newPos = clamp(barPos.x.get() + params.delta[0], MARGIN_WIDTH, bodyWidth - MARGIN_WIDTH); const newValue = newPos / (bodyWidth - MARGIN_WIDTH); @@ -33,20 +33,17 @@ export function ProgressSlider({ // const // console.log("main", bodyWidth, barPos.x.get()); - console.log("main",barPos.x.get()); + // console.log("main",barPos.x.get()); + // console.log(bodyWidth); return ( - {/* */} - - {/* */} - - - - {/* */} - - {/* */} + + + + + ); diff --git a/src/components/Common/Inputs/ProgressSlider/styles.ts b/src/components/Common/Inputs/ProgressSlider/styles.ts index dcf57cb..ff3447d 100644 --- a/src/components/Common/Inputs/ProgressSlider/styles.ts +++ b/src/components/Common/Inputs/ProgressSlider/styles.ts @@ -17,10 +17,13 @@ export const ProgressSliderBody = styled.div` `; type ProgressSliderBarProps = { + bodyWidth: number, color?: string, }; -export const ProgressSliderBar = styled.div` +export const ProgressSliderBar = styled(animated.div)` position: absolute; + left: ${({ bodyWidth }) => `${-bodyWidth}px`}; + /* left: -359px; */ height: 100%; width: 100%; background-color: ${({ color }) => (color ?? (p => p.theme.colors.activeGreen))}; @@ -29,9 +32,9 @@ ProgressSliderBar.displayName = "ProgressSliderBar"; export const ProgressSliderBarHandleContainer = styled(animated.div)` + position: absolute; width: 100%; height: 100%; - position: absolute; `; ProgressSliderBarHandleContainer.displayName = "ProgressSliderBarHandleContainer"; @@ -39,15 +42,14 @@ export const ProgressSliderBarHandle = styled.div` position: relative; width: 1ch; height: 1.2em; - background-color: white; - /* margin: 2px; */ + background-color: black; margin-top: 1px; border-radius: 3px; opacity: 0.5; cursor: pointer; &:hover { - opacity: 0.9; + opacity: 0.8; } `; ProgressSliderBarHandle.displayName = "ProgressSliderBarHandle";