import React from 'react'; import { Button, Checkbox, Form } from 'semantic-ui-react' import styles from './styles' export default class ContactForm extends React.Component { constructor(props) { super(props) this.state = { values: {...props.contact} } } setValue(key, value) { let new_values = {...this.state.values} new_values[key] = value this.setState({ values: new_values }) } render() { const { contact, onSave, onCancel } = this.props const { values } = this.state let fields = ["alias", "node_alias", "id", "public_key"] return (
onSave(contact.id, values)}> {fields.map(field => ( this.setValue(field, e.target.value)} /> ))} this.setValue('is_owner', !!!values.is_owner)} checked={values.is_owner == true} />
x
) } }