import "./KeymapsForm.scss"; import React from "react"; import Input from "../ui/Input"; import keymaps from "../../keymaps"; import { FormKeymaps } from "../../../shared/SettingData"; interface Props { value: FormKeymaps; onChange: (e: FormKeymaps) => void; onBlur: () => void; } class KeymapsForm extends React.Component { public static defaultProps: Props = { value: FormKeymaps.fromJSON({}), onChange: () => {}, onBlur: () => {}, }; render() { const values = this.props.value.toJSON(); return (
{keymaps.fields.map((group, index) => { return (
{group.map(([name, label]) => { const value = values[name] || ""; return ( ); })}
); })}
); } bindValue(name: string, value: string) { this.props.onChange(this.props.value.buildWithOverride(name, value)); } } export default KeymapsForm;