import { FormError } from '../FormError'; import { InputLabeled } from '../Input/InputLabeled'; import { ItemProps } from '../InputList'; import { EnvVar } from './types'; export function EnvironmentVariableItem({ item, onChange, disabled, error, readOnly, index, }: ItemProps) { return (
handleChange({ name: e.target.value })} disabled={disabled} needsDeletion={item.needsDeletion} readOnly={readOnly} placeholder="e.g. FOO" size="small" id={`env-name${index}`} /> {error && (
{Object.values(error)[0]}
)}
handleChange({ value: e.target.value })} disabled={disabled} needsDeletion={item.needsDeletion} readOnly={readOnly} placeholder="e.g. bar" size="small" id={`env-value${index}`} />
); function handleChange(partial: Partial) { onChange({ ...item, ...partial }); } }