/* eslint-disable no-param-reassign */ import React from 'react'; import { CustomPicker } from 'react-color'; import { EditableInput, Hue, Saturation, } from 'react-color/lib/components/common'; import Button from '../Button'; import { Wrapper, HueWrapper, SaturationWrapper, Label, InputWrapper, Swatch, } from './styled'; type ColorType = { h?: string; s?: string; l?: string; v?: string; a?: string; hex?: string; }; type Props = { hex: string; hsl: object; hsv: object; onChange: (info: ColorType) => void; onSubmit: (color: any) => void; }; const ColorPicker: React.FC = ({ hex, hsl, hsv, onChange, onSubmit, }: Props) => { const styles = { input: { height: 28, width: '80px', border: `1px solid white`, color: 'white', backgroundColor: 'transparent', paddingLeft: 10, borderRadius: '4px', }, }; const handleClick = () => { onSubmit({ hex, hsl, hsv }); }; return ( ); }; const areEqual = (prevProps: any, nextProps: any) => { if (prevProps.color !== nextProps.color) { return false; } return true; }; export default React.memo(CustomPicker(ColorPicker), areEqual);