import { useCallback, useRef } from 'react'; import { Input } from 'antd'; import { useField } from 'react-final-form'; import { FieldProps } from './types'; import { getLabel } from './utils'; import Color from 'color'; import InfoBubble from './InfoBubble'; import FieldContainer from './FieldContainer'; export const FieldTextColor = (props: FieldProps) => { const field = useField(props.name); const t = useRef(); const onChange = useCallback( ({ target: { value } }) => { t.current && clearTimeout(t.current); t.current = setTimeout(() => { field.input.onChange(value); }, 100); }, [field] ); const colorIsLight = Color(field.input.value || 'black').isLight(); return (
); }; export default FieldTextColor;