aboutsummaryrefslogtreecommitdiff
path: root/src/settings/components
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-04-30 09:15:58 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-04-30 09:15:58 +0900
commitfce2434dcdef126a3ab180447e7cb48bc24ec1f9 (patch)
treec5b0671c7f9968216e962702a0628d76be21c97c /src/settings/components
parent808344eecfedd04149551867724e46a7988c45a0 (diff)
Specify default props
Diffstat (limited to 'src/settings/components')
-rw-r--r--src/settings/components/form/BlacklistForm.jsx5
-rw-r--r--src/settings/components/form/KeymapsForm.jsx5
-rw-r--r--src/settings/components/form/PropertiesForm.jsx12
-rw-r--r--src/settings/components/form/SearchForm.jsx5
4 files changed, 8 insertions, 19 deletions
diff --git a/src/settings/components/form/BlacklistForm.jsx b/src/settings/components/form/BlacklistForm.jsx
index cee04bd..cf7cffe 100644
--- a/src/settings/components/form/BlacklistForm.jsx
+++ b/src/settings/components/form/BlacklistForm.jsx
@@ -25,10 +25,6 @@ class BlacklistForm extends React.Component {
}
bindValue(e) {
- if (!this.props.onChange) {
- return;
- }
-
let name = e.target.name;
let index = e.target.getAttribute('data-index');
let next = this.props.value ? this.props.value.slice() : [];
@@ -52,6 +48,7 @@ BlacklistForm.propTypes = {
BlacklistForm.defaultProps = {
value: [],
+ onChange: () => {},
};
export default BlacklistForm;
diff --git a/src/settings/components/form/KeymapsForm.jsx b/src/settings/components/form/KeymapsForm.jsx
index 26a22d7..5bb65cb 100644
--- a/src/settings/components/form/KeymapsForm.jsx
+++ b/src/settings/components/form/KeymapsForm.jsx
@@ -30,10 +30,6 @@ class KeymapsForm extends React.Component {
}
bindValue(e) {
- if (!this.props.onChange) {
- return;
- }
-
let next = { ...this.props.value };
next[e.target.name] = e.target.value;
@@ -48,6 +44,7 @@ KeymapsForm.propTypes = {
KeymapsForm.defaultProps = {
value: {},
+ onChange: () => {},
};
export default KeymapsForm;
diff --git a/src/settings/components/form/PropertiesForm.jsx b/src/settings/components/form/PropertiesForm.jsx
index 9143a7a..0014899 100644
--- a/src/settings/components/form/PropertiesForm.jsx
+++ b/src/settings/components/form/PropertiesForm.jsx
@@ -7,9 +7,6 @@ class PropertiesForm extends React.Component {
render() {
let types = this.props.types;
let value = this.props.value;
- if (!value) {
- value = {};
- }
return <div className='form-properties-form'>
{
@@ -40,10 +37,6 @@ class PropertiesForm extends React.Component {
}
bindValue(e) {
- if (!this.props.onChange) {
- return;
- }
-
let name = e.target.name;
let next = { ...this.props.value };
if (e.target.type.toLowerCase() === 'checkbox') {
@@ -63,4 +56,9 @@ PropertiesForm.propTypes = {
onChange: PropTypes.func,
};
+PropertiesForm.defaultProps = {
+ value: {},
+ onChange: () => {},
+};
+
export default PropertiesForm;
diff --git a/src/settings/components/form/SearchForm.jsx b/src/settings/components/form/SearchForm.jsx
index 2e070fc..d2f2d48 100644
--- a/src/settings/components/form/SearchForm.jsx
+++ b/src/settings/components/form/SearchForm.jsx
@@ -44,10 +44,6 @@ class SearchForm extends React.Component {
}
bindValue(e) {
- if (!this.props.onChange) {
- return;
- }
-
let value = this.props.value;
let name = e.target.name;
let index = e.target.getAttribute('data-index');
@@ -83,6 +79,7 @@ SearchForm.propTypes = {
SearchForm.defaultProps = {
value: { default: '', engines: []},
+ onChange: () => {},
};
export default SearchForm;