add button
This commit is contained in:
parent
df10208ed5
commit
5070006193
4 changed files with 23 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
import './blacklist-form.scss';
|
import './blacklist-form.scss';
|
||||||
|
import AddButton from '../ui/add-button';
|
||||||
import DeleteButton from '../ui/delete-button';
|
import DeleteButton from '../ui/delete-button';
|
||||||
import { h, Component } from 'preact';
|
import { h, Component } from 'preact';
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ class BlacklistForm extends Component {
|
||||||
</div>;
|
</div>;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
<AddButton name='add' onClick={this.bindValue.bind(this)} />
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +38,8 @@ class BlacklistForm extends Component {
|
||||||
|
|
||||||
if (name === 'url') {
|
if (name === 'url') {
|
||||||
next[index] = e.target.value;
|
next[index] = e.target.value;
|
||||||
|
} else if (name === 'add') {
|
||||||
|
next.push('');
|
||||||
} else if (name === 'delete') {
|
} else if (name === 'delete') {
|
||||||
next.splice(index, 1);
|
next.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import './search-engine-form.scss';
|
import './search-engine-form.scss';
|
||||||
import { h, Component } from 'preact';
|
import { h, Component } from 'preact';
|
||||||
|
import AddButton from '../ui/add-button';
|
||||||
import DeleteButton from '../ui/delete-button';
|
import DeleteButton from '../ui/delete-button';
|
||||||
|
|
||||||
class SearchEngineForm extends Component {
|
class SearchEngineForm extends Component {
|
||||||
|
@ -40,6 +41,7 @@ class SearchEngineForm extends Component {
|
||||||
</div>;
|
</div>;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
<AddButton name='add' onClick={this.bindValue.bind(this)} />
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +60,8 @@ class SearchEngineForm extends Component {
|
||||||
next.engines[index][1] = e.target.value;
|
next.engines[index][1] = e.target.value;
|
||||||
} else if (name === 'default') {
|
} else if (name === 'default') {
|
||||||
next.default = this.props.value.engines[index][0];
|
next.default = this.props.value.engines[index][0];
|
||||||
|
} else if (name === 'add') {
|
||||||
|
next.engines.push(['', '']);
|
||||||
} else if (name === 'delete') {
|
} else if (name === 'delete') {
|
||||||
next.engines.splice(index, 1);
|
next.engines.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
12
src/settings/components/ui/add-button.jsx
Normal file
12
src/settings/components/ui/add-button.jsx
Normal file
|
@ -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;
|
3
src/settings/components/ui/add-button.scss
Normal file
3
src/settings/components/ui/add-button.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.ui-add-button {
|
||||||
|
font-size: 80%
|
||||||
|
}
|
Reference in a new issue