From 507000619377f82ca63251c8c5db98af690a5ed2 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 25 Nov 2017 15:08:41 +0900 Subject: add button --- src/settings/components/form/blacklist-form.jsx | 4 ++++ src/settings/components/form/search-engine-form.jsx | 4 ++++ src/settings/components/ui/add-button.jsx | 12 ++++++++++++ src/settings/components/ui/add-button.scss | 3 +++ 4 files changed, 23 insertions(+) create mode 100644 src/settings/components/ui/add-button.jsx create mode 100644 src/settings/components/ui/add-button.scss (limited to 'src/settings/components') 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 { ; }) } + ; } @@ -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 { ; }) } + ; } @@ -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 ; + } +} + +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% +} -- cgit v1.2.3