import { Plus } from 'lucide-react';

interface ImageFormProps {
  url: string;
  caption: string;
  alt: string;
  onUrlChange: (url: string) => void;
  onCaptionChange: (caption: string) => void;
  onAltChange: (alt: string) => void;
  onSubmit: () => void;
  submitLabel: string;
}

export function ImageForm({
  url,
  caption,
  alt,
  onUrlChange,
  onCaptionChange,
  onAltChange,
  onSubmit,
  submitLabel
}: ImageFormProps) {
  return (
    <div className="space-y-3">
      <div>
        <label htmlFor="imageUrl" className="block text-sm font-medium text-gray-700">
          <span className="italic font-bold">URL изображения</span>
        </label>
        <input
          type="url"
          id="imageUrl"
          value={url}
          onChange={(e) => onUrlChange(e.target.value)}
          className="px-2 py-1 mt-1 block w-full rounded-lg border border-gray-300 shadow-sm hover:border-blue-300 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 transition-all duration-200"
          placeholder="https://example.com/image.jpg"
        />
      </div>
      <div>
        <label htmlFor="imageCaption" className="block text-sm font-medium text-gray-700">
          <span className="italic font-bold">Заголовок</span>
        </label>
        <input
          type="text"
          id="imageCaption"
          value={caption}
          onChange={(e) => onCaptionChange(e.target.value)}
          className="px-2 py-1 mt-1 block w-full rounded-lg border border-gray-300 shadow-sm hover:border-blue-300 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 transition-all duration-200"
        />
      </div>
      <div>
        <label htmlFor="imageAlt" className="block text-sm font-medium text-gray-700">
          <span className="italic font-bold">Текст при наведении</span>
        </label>
        <input
          type="text"
          id="imageAlt"
          value={alt}
          onChange={(e) => onAltChange(e.target.value)}
          className="px-2 py-1 mt-1 block w-full rounded-lg border border-gray-300 shadow-sm hover:border-blue-300 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 transition-all duration-200"
        />
      </div>
      <button
        onClick={onSubmit}
        disabled={!url.trim()}
        className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
      >
        <Plus size={16} className="mr-2" />
        {submitLabel}
      </button>
    </div>
  );
}