import React from 'react'; import './fields.css'; type ColorInputProps = { label?: string; description?: string; value: string; onChange: (value: string) => void; defaultValue?: string; resetLabel?: string; disabled?: boolean; }; export const ColorInput: React.FC = ({ label, description, value, onChange, defaultValue, resetLabel = 'Reset', disabled, }) => { const canReset = Boolean(defaultValue) && value !== defaultValue; return (
{label &&
{label}
}
onChange(e.target.value)} disabled={disabled} /> {canReset && ( )}
{description &&
{description}
}
); };