diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-25 15:08:41 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-26 11:45:05 +0900 |
commit | 507000619377f82ca63251c8c5db98af690a5ed2 (patch) | |
tree | a08a8b6b8dca715d22f35b69b6b20c2b0ec0499c | |
parent | df10208ed5dfbc823eb1979272903d74f02a898c (diff) |
add button
-rw-r--r-- | src/settings/components/form/blacklist-form.jsx | 4 | ||||
-rw-r--r-- | src/settings/components/form/search-engine-form.jsx | 4 | ||||
-rw-r--r-- | src/settings/components/ui/add-button.jsx | 12 | ||||
-rw-r--r-- | src/settings/components/ui/add-button.scss | 3 |
4 files changed, 23 insertions, 0 deletions
diff --git a/src/settings/components/form/blacklist-form.jsx b/src/settings/components/form/blacklist-form.jsx index 83b54da..9cb547b 100644 --- a/src/settings/components/form/blacklist-form.jsx +++ b/src/settings/components/form/blacklist-form.jsx @@ -1,4 +1,5 @@ import './blacklist-form.scss'; +import AddButton from '../ui/add-button'; import DeleteButton from '../ui/delete-button'; import { h, Component } from 'preact'; @@ -22,6 +23,7 @@ class BlacklistForm extends Component { </div>; }) } + <AddButton name='add' onClick={this.bindValue.bind(this)} /> </div>; } @@ -36,6 +38,8 @@ class BlacklistForm extends Component { if (name === 'url') { next[index] = e.target.value; + } else if (name === 'add') { + next.push(''); } else if (name === 'delete') { next.splice(index, 1); } diff --git a/src/settings/components/form/search-engine-form.jsx b/src/settings/components/form/search-engine-form.jsx index c86522a..faa066f 100644 --- a/src/settings/components/form/search-engine-form.jsx +++ b/src/settings/components/form/search-engine-form.jsx @@ -1,5 +1,6 @@ import './search-engine-form.scss'; import { h, Component } from 'preact'; +import AddButton from '../ui/add-button'; import DeleteButton from '../ui/delete-button'; class SearchEngineForm extends Component { @@ -40,6 +41,7 @@ class SearchEngineForm extends Component { </div>; }) } + <AddButton name='add' onClick={this.bindValue.bind(this)} /> </div>; } @@ -58,6 +60,8 @@ class SearchEngineForm extends Component { next.engines[index][1] = e.target.value; } else if (name === 'default') { next.default = this.props.value.engines[index][0]; + } else if (name === 'add') { + next.engines.push(['', '']); } else if (name === 'delete') { next.engines.splice(index, 1); } diff --git a/src/settings/components/ui/add-button.jsx b/src/settings/components/ui/add-button.jsx new file mode 100644 index 0000000..c8d8856 --- /dev/null +++ b/src/settings/components/ui/add-button.jsx @@ -0,0 +1,12 @@ +import './add-button.scss'; +import { h, Component } from 'preact'; + +class AddButton extends Component { + render() { + return <input + className='ui-add-button' type='button' value='Add' + {...this.props} />; + } +} + +export default AddButton; diff --git a/src/settings/components/ui/add-button.scss b/src/settings/components/ui/add-button.scss new file mode 100644 index 0000000..1c893ae --- /dev/null +++ b/src/settings/components/ui/add-button.scss @@ -0,0 +1,3 @@ +.ui-add-button { + font-size: 80% +} |