import './KeymapsForm.scss'; import React from 'react'; import PropTypes from 'prop-types'; import Input from '../ui/Input'; import keymaps from '../../keymaps'; class KeymapsForm extends React.Component { render() { let values = this.props.value; if (!values) { values = {}; } return
{ keymaps.fields.map((group, index) => { return
{ group.map((field) => { let name = field[0]; let label = field[1]; let value = values[name]; return ; }) }
; }) }
; } bindValue(e) { if (!this.props.onChange) { return; } let next = { ...this.props.value }; next[e.target.name] = e.target.value; this.props.onChange(next); } } KeymapsForm.propTypes = { value: PropTypes.objectOf(PropTypes.string), onChange: PropTypes.func, }; export default KeymapsForm;