import './KeymapsForm.scss'; import React from 'react'; import Input from '../ui/Input'; import keymaps from '../../keymaps'; type Value = {[key: string]: string}; interface Props{ value: Value; onChange: (e: Value) => void; onBlur: () => void; } class KeymapsForm extends React.Component { public static defaultProps: Props = { value: {}, onChange: () => {}, onBlur: () => {}, } render() { return
{ keymaps.fields.map((group, index) => { return
{ group.map((field) => { let name = field[0]; let label = field[1]; let value = this.props.value[name] || ''; return ; }) }
; }) }
; } bindValue(name: string, value: string) { let next = { ...this.props.value }; next[name] = value; this.props.onChange(next); } } export default KeymapsForm;