import { TextField as MuiTextField } from '@mui/material';
import { FieldComponentProps } from '../../types/overrides';

export default function TextField({ field, value, onChange, disabled }: FieldComponentProps) {
  const isMarkdown = field.type === 'markdown';
  return (
    <MuiTextField
      fullWidth
      label={field.label}
      value={value || ''}
      multiline={isMarkdown}
      rows={isMarkdown ? 4 : 1}
      onChange={(e) => onChange(e.target.value)}
      disabled={disabled}
      required={field.required}
    />
  );
}
