import React from 'react'
import PropTypes from 'prop-types'
import ReactModal from 'react-modal'
import styles from './PeerForm.scss'
const PeerForm = ({ form, setForm, connect }) => {
const submit = () => {
const { pubkey, host } = form
connect({ pubkey, host })
}
return (
setForm({ isOpen: false })}
parentSelector={() => document.body}
className={styles.modal}
>
event.charCode === 13 && submit()}>
Connect to a peer
)
}
PeerForm.propTypes = {
form: PropTypes.object.isRequired,
setForm: PropTypes.func.isRequired,
connect: PropTypes.func.isRequired
}
export default PeerForm