From f538f61464c9d75053645c9c4c5ee45efc99138e Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 30 Jan 2026 18:28:30 +0000 Subject: [PATCH] slider update --- client/src/Components/v2/inputs/Slider.tsx | 103 ++++++++++++--------- client/src/Pages/CreateMonitor/index.tsx | 3 +- 2 files changed, 63 insertions(+), 43 deletions(-) diff --git a/client/src/Components/v2/inputs/Slider.tsx b/client/src/Components/v2/inputs/Slider.tsx index 5da704783..97a16ac2c 100644 --- a/client/src/Components/v2/inputs/Slider.tsx +++ b/client/src/Components/v2/inputs/Slider.tsx @@ -1,69 +1,88 @@ +import Typography from "@mui/material/Typography"; import { forwardRef } from "react"; import Slider from "@mui/material/Slider"; import type { SliderProps } from "@mui/material/Slider"; import { useTheme } from "@mui/material/styles"; import Stack from "@mui/material/Stack"; import { FieldLabel } from "./FieldLabel"; +import Box from "@mui/material/Box"; +import type { ResponsiveStyleValue } from "@mui/system"; -export const SliderInput = forwardRef(function SliderInput( - { sx, ...props }, - ref -) { - const theme = useTheme(); - const additionalSx = Array.isArray(sx) ? sx : sx ? [sx] : []; +interface SliderInputProps extends SliderProps { + sx?: SliderProps["sx"]; + showValue?: boolean; +} - return ( - ( + ({ sx, showValue = false, ...props }, ref) => { + const theme = useTheme(); + const additionalSx = Array.isArray(sx) ? sx : sx ? [sx] : []; + + return ( + + {showValue && {props.value}} + - ); -}); + ...additionalSx, + ]} + /> + + ); + } +); interface SliderWithLabelProps extends SliderProps { fieldLabel?: string; required?: boolean; showValue?: boolean; - valueSuffix?: string; + sliderMaxWidth?: ResponsiveStyleValue; } export const SliderWithLabel = forwardRef( - function SliderWithLabel( - { fieldLabel, required, showValue = true, valueSuffix = "", value, ...props }, + ( + { fieldLabel, required, showValue = true, value, sliderMaxWidth = "100%", ...props }, ref - ) { + ) => { const theme = useTheme(); - const labelText = showValue && value !== undefined - ? `${fieldLabel}: ${value}${valueSuffix}` - : fieldLabel; + const labelText = fieldLabel; return ( {fieldLabel && {labelText}} - + + + ); } diff --git a/client/src/Pages/CreateMonitor/index.tsx b/client/src/Pages/CreateMonitor/index.tsx index 20d1ba96b..efa1c9484 100644 --- a/client/src/Pages/CreateMonitor/index.tsx +++ b/client/src/Pages/CreateMonitor/index.tsx @@ -374,6 +374,7 @@ const CreateMonitorPage = () => { render={({ field }) => ( { render={({ field }) => (