import * as SliderPrimitive from "@radix-ui/react-slider"; import { cva, type VariantProps } from "class-variance-authority"; import { forwardRef, memo } from "react"; import cn from "@/helpers/cn"; const thumbVariants = cva( "block bg-gray-900 focus:outline-hidden active:scale-110", { defaultVariants: { showValueInThumb: false }, variants: { showValueInThumb: { false: "size-5 rounded-full", true: "rounded-lg px-2 py-1 font-bold text-white text-xs" } } } ); interface RangeSliderProps extends SliderPrimitive.SliderProps, VariantProps { className?: string; displayValue?: string; } const RangeSlider = forwardRef( ({ className = "", displayValue, showValueInThumb, ...rest }, ref) => { return ( {showValueInThumb ? displayValue || rest.value : null} ); } ); export default memo(RangeSlider);