import { useState } from 'react'; import { Search } from 'lucide-react'; interface Props { onSearch: (imo: string) => void; } export function YachtSearch({ onSearch }: Props) { const [imo, setImo] = useState(''); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); const cleanedImo = imo.trim().replace(/[^0-9]/g, ''); if (cleanedImo.length === 7) { onSearch(cleanedImo); } }; const handleChange = (e: React.ChangeEvent) => { const value = e.target.value.replace(/[^0-9]/g, '').slice(0, 7); setImo(value); }; return (
{imo.length > 0 && imo.length < 7 && (

IMO number must be 7 digits

)}
); }