From be7ba9a5046e6e3237324870fb3d94e57f4d792e Mon Sep 17 00:00:00 2001 From: gunshiz Date: Tue, 15 Sep 2026 18:56:28 +0700 Subject: [PATCH] fix : lint on color-picker --- components/ui/color-picker.tsx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/components/ui/color-picker.tsx b/components/ui/color-picker.tsx index 8308c44..28dd035 100644 --- a/components/ui/color-picker.tsx +++ b/components/ui/color-picker.tsx @@ -90,7 +90,7 @@ export const ColorPicker = ({ onChange([rgba[0], rgba[1], rgba[2], next.alpha / 100]) } }, - [onChange], + [onChange, setHueState, setSaturationState, setLightnessState, setAlphaState], ) const setHue = useCallback((next: number) => updateColor({ hue: next }), [updateColor]) @@ -119,6 +119,8 @@ export const ColorPicker = ({ } channelsRef.current = next + // Synchronize the internal channels when the controlled value changes. + // eslint-disable-next-line react-hooks/set-state-in-effect setHueState(next.hue) setSaturationState(next.saturation) setLightnessState(next.lightness) @@ -141,7 +143,7 @@ export const ColorPicker = ({ setMode, }} > -
+
) } @@ -198,7 +200,7 @@ export const ColorPickerSelection = memo(({ className, ...props }: ColorPickerSe style={{ background: backgroundGradient, }} - {...(props as any)} + {...props} >
onValueChange={([hue]) => setHue(hue)} step={1} value={[hue]} - {...(props as any)} + {...props} > @@ -248,7 +250,7 @@ export const ColorPickerAlpha = ({ className, ...props }: ColorPickerAlphaProps) onValueChange={([alpha]) => setAlpha(alpha)} step={1} value={[alpha]} - {...(props as any)} + {...props} > - + ) } @@ -315,7 +317,7 @@ export const ColorPickerOutput = ({ className, ...props }: ColorPickerOutputProp }} value={mode} > - + @@ -337,7 +339,7 @@ const PercentageInput = ({ className, ...props }: PercentageInputProps) => { {rgb.map((value, index) => ( Math.round(value)) return ( -
+
) @@ -435,7 +436,7 @@ export const ColorPickerFormat = ({ className, ...props }: ColorPickerFormatProp return (
{hsl.map((value, index) => (