github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/nodes/stampzilla-server/web/src/components/SocketModal.js (about) 1 import React, { Component } from 'react'; 2 3 import FormModal from './FormModal'; 4 5 const schema = { 6 type: 'object', 7 required: ['hostname', 'port'], 8 properties: { 9 hostname: { type: 'string', title: 'Hostname', default: 'localhost' }, 10 port: { type: 'string', title: 'Port', default: '8080' }, 11 }, 12 }; 13 14 class SocketModal extends Component { 15 onChange = () => ({ formData }) => { 16 this.props.onChange(formData); 17 this.props.onClose(); 18 } 19 20 render = () => { 21 const { visible, onClose } = this.props; 22 23 return ( 24 <FormModal 25 title="Change websocket url" 26 schema={schema} 27 isOpen={visible} 28 onClose={onClose} 29 onSubmit={this.onChange()} 30 submitButton="Change" 31 /> 32 ); 33 } 34 } 35 36 export default SocketModal;