import { useState } from 'react'; import { useMessages } from 'hooks'; import { Button, Form, FormRow, TextField, Flexbox } from 'react-basics'; import styles from './UrlAddForm.module.css'; import PopupForm from '../PopupForm'; export function UrlAddForm({ defaultValue = '', element, onAdd, onClose }) { const [url, setUrl] = useState(defaultValue); const { formatMessage, labels } = useMessages(); const handleSave = () => { onAdd(url); setUrl(''); onClose(); }; const handleChange = e => { setUrl(e.target.value); }; const handleKeyDown = e => { if (e.key === 'Enter') { e.stopPropagation(); handleSave(); } }; return (
); } export default UrlAddForm;