parent
25111f9de4
commit
be900aa25c
18 changed files with 77 additions and 74 deletions
@ -0,0 +1,47 @@ |
||||
import './KeymapsForm.scss'; |
||||
import React from 'react'; |
||||
import Input from '../ui/Input'; |
||||
import keymaps from '../../keymaps'; |
||||
|
||||
class KeymapsForm extends React.Component { |
||||
|
||||
render() { |
||||
let values = this.props.value; |
||||
if (!values) { |
||||
values = {}; |
||||
} |
||||
return <div className='form-keymaps-form'> |
||||
{ |
||||
keymaps.fields.map((group, index) => { |
||||
return <div key={index} className='form-keymaps-form-field-group'> |
||||
{ |
||||
group.map((field) => { |
||||
let name = field[0]; |
||||
let label = field[1]; |
||||
let value = values[name]; |
||||
return <Input |
||||
type='text' id={name} name={name} key={name} |
||||
label={label} value={value} |
||||
onChange={this.bindValue.bind(this)} |
||||
/>; |
||||
}) |
||||
} |
||||
</div>; |
||||
}) |
||||
} |
||||
</div>; |
||||
} |
||||
|
||||
bindValue(e) { |
||||
if (!this.props.onChange) { |
||||
return; |
||||
} |
||||
|
||||
let next = { ...this.props.value }; |
||||
next[e.target.name] = e.target.value; |
||||
|
||||
this.props.onChange(next); |
||||
} |
||||
} |
||||
|
||||
export default KeymapsForm; |
@ -1,4 +1,4 @@ |
||||
import './properties-form.scss'; |
||||
import './PropertiesForm.scss'; |
||||
import React from 'react'; |
||||
|
||||
class PropertiesForm extends React.Component { |
@ -1,4 +1,4 @@ |
||||
import './add-button.scss'; |
||||
import './AddButton.scss'; |
||||
import React from 'react'; |
||||
|
||||
class AddButton extends React.Component { |
@ -1,4 +1,4 @@ |
||||
import './delete-button.scss'; |
||||
import './DeleteButton.scss'; |
||||
import React from 'react'; |
||||
|
||||
class DeleteButton extends React.Component { |
@ -1,5 +1,5 @@ |
||||
import React from 'react'; |
||||
import './input.scss'; |
||||
import './Input.scss'; |
||||
|
||||
class Input extends React.Component { |
||||
|
Reference in new issue