
import React from "react";
import { Button } from "@/components/ui/button";

interface URLInputProps {
  value: string;
  onChange: (value: string) => void;
  onSubmit: () => void;
  disabled?: boolean;
}

const URLInput = ({ value, onChange, onSubmit, disabled = false }: URLInputProps) => {
  return (
    <div className="space-y-4">
      <div className="flex space-x-2">
        <input
          type="url"
          value={value}
          onChange={(e) => onChange(e.target.value)}
          placeholder="Coller l'URL de l'image"
          className="flex-1 px-3 py-2 border border-gray-300 rounded-md text-sm"
          disabled={disabled}
        />
        <Button 
          onClick={onSubmit} 
          size="sm"
          disabled={!value.trim() || disabled}
        >
          Ajouter
        </Button>
      </div>
      <p className="text-xs text-gray-500">
        Vous pouvez également coller une URL d'image externe
      </p>
    </div>
  );
};

export default URLInput;
