Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit 6cbc67c

Browse files
committed
Update default props for dat components
1 parent a87eb14 commit 6cbc67c

File tree

7 files changed

+25
-54
lines changed

7 files changed

+25
-54
lines changed

src/components/DatBoolean.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@ export default class DatBoolean extends Component {
88
static propTypes = {
99
className: PropTypes.string,
1010
style: PropTypes.object,
11-
data: PropTypes.object,
11+
data: PropTypes.object.isRequired,
1212
path: PropTypes.string,
1313
label: PropTypes.string,
1414
labelWidth: PropTypes.string.isRequired,
15-
onUpdate: PropTypes.func,
16-
_onUpdateValue: PropTypes.func
15+
_onUpdateValue: PropTypes.func.isRequired
1716
};
1817

1918
static defaultProps = {
2019
className: null,
2120
style: null,
22-
data: null,
2321
path: null,
24-
label: null,
25-
onUpdate: () => null,
26-
_onUpdateValue: () => null
22+
label: null
2723
};
2824

2925
constructor(props) {
@@ -46,10 +42,9 @@ export default class DatBoolean extends Component {
4642

4743
handleChange = event => {
4844
const value = event.target.checked;
49-
const { onUpdate, _onUpdateValue, path } = this.props;
45+
const { _onUpdateValue, path } = this.props;
5046

5147
_onUpdateValue(path, value);
52-
onUpdate(value);
5348
};
5449

5550
render() {

src/components/DatColor.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,18 @@ export default class DatColor extends Component {
99
static propTypes = {
1010
className: PropTypes.string,
1111
style: PropTypes.object,
12-
data: PropTypes.object,
12+
data: PropTypes.object.isRequired,
1313
path: PropTypes.string,
1414
label: PropTypes.string,
1515
labelWidth: PropTypes.string.isRequired,
16-
liveUpdate: PropTypes.bool,
17-
onUpdate: PropTypes.func,
18-
_onUpdateValue: PropTypes.func
16+
_onUpdateValue: PropTypes.func.isRequired
1917
};
2018

2119
static defaultProps = {
2220
className: null,
2321
style: null,
24-
data: null,
2522
path: null,
26-
label: null,
27-
liveUpdate: null,
28-
onUpdate: () => null,
29-
_onUpdateValue: () => null
23+
label: null
3024
};
3125

3226
constructor() {
@@ -60,10 +54,9 @@ export default class DatColor extends Component {
6054

6155
handleChangeColor = color => {
6256
const value = isString(color) ? color : color.hex;
63-
const { _onUpdateValue, onUpdate, path } = this.props;
57+
const { _onUpdateValue, path } = this.props;
6458

6559
_onUpdateValue(path, value);
66-
onUpdate(value);
6760
};
6861

6962
renderPicker() {

src/components/DatNumber.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ export default class DatNumber extends Component {
4646
min: PropTypes.number,
4747
max: PropTypes.number,
4848
step: PropTypes.number,
49-
data: PropTypes.object,
49+
data: PropTypes.object.isRequired,
5050
path: PropTypes.string,
5151
label: PropTypes.string,
5252
labelWidth: PropTypes.string.isRequired,
53-
liveUpdate: PropTypes.bool,
54-
onUpdate: PropTypes.func,
55-
_onUpdateValue: PropTypes.func,
53+
_onUpdateValue: PropTypes.func.isRequired,
5654
disableSlider: PropTypes.bool
5755
};
5856

@@ -62,12 +60,8 @@ export default class DatNumber extends Component {
6260
min: null,
6361
max: null,
6462
step: null,
65-
data: null,
6663
path: null,
6764
label: null,
68-
liveUpdate: null,
69-
onUpdate: () => null,
70-
_onUpdateValue: () => null,
7165
disableSlider: null
7266
};
7367

@@ -102,10 +96,9 @@ export default class DatNumber extends Component {
10296
};
10397

10498
update = value => {
105-
const { onUpdate, _onUpdateValue, path } = this.props;
99+
const { _onUpdateValue, path } = this.props;
106100

107101
_onUpdateValue(path, toNumber(value));
108-
onUpdate(toNumber(value));
109102
};
110103

111104
renderSlider(width) {

src/components/DatPresets.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,19 @@ export default class DatPresets extends Component {
1010
static propTypes = {
1111
className: PropTypes.string,
1212
style: PropTypes.object,
13-
data: PropTypes.object,
13+
data: PropTypes.object.isRequired,
1414
path: PropTypes.string,
1515
label: PropTypes.string.isRequired,
1616
options: PropTypes.array.isRequired,
1717
labelWidth: PropTypes.string.isRequired,
18-
liveUpdate: PropTypes.bool,
19-
onUpdate: PropTypes.func
18+
liveUpdate: PropTypes.bool.isRequired,
19+
onUpdate: PropTypes.func.isRequired
2020
};
2121

2222
static defaultProps = {
2323
className: null,
2424
style: null,
25-
data: null,
26-
path: null,
27-
liveUpdate: true,
28-
onUpdate: () => null
25+
path: null
2926
};
3027

3128
constructor() {

src/components/DatSelect.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,22 @@ export default class DatSelect extends Component {
88
static propTypes = {
99
className: PropTypes.string,
1010
style: PropTypes.object,
11-
data: PropTypes.object,
11+
data: PropTypes.object.isRequired,
1212
path: PropTypes.string,
1313
label: PropTypes.string,
1414
options: PropTypes.array.isRequired,
1515
labelWidth: PropTypes.string.isRequired,
16-
liveUpdate: PropTypes.bool,
16+
liveUpdate: PropTypes.bool.isRequired,
1717
onUpdate: PropTypes.func,
18-
_onUpdateValue: PropTypes.func
18+
_onUpdateValue: PropTypes.func.isRequired
1919
};
2020

2121
static defaultProps = {
2222
className: null,
2323
style: null,
24-
data: null,
2524
path: null,
2625
label: null,
27-
liveUpdate: true,
28-
onUpdate: () => null,
29-
_onUpdateValue: () => null
26+
onUpdate: () => null
3027
};
3128

3229
constructor() {

src/components/DatString.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,21 @@ export default class DatString extends Component {
88
static propTypes = {
99
className: PropTypes.string,
1010
style: PropTypes.object,
11-
data: PropTypes.object,
11+
data: PropTypes.object.isRequired,
1212
path: PropTypes.string,
1313
label: PropTypes.string,
1414
labelWidth: PropTypes.string.isRequired,
15-
liveUpdate: PropTypes.bool,
15+
liveUpdate: PropTypes.bool.isRequired,
1616
onUpdate: PropTypes.func,
17-
_onUpdateValue: PropTypes.func
17+
_onUpdateValue: PropTypes.func.isRequired
1818
};
1919

2020
static defaultProps = {
2121
className: null,
2222
style: null,
23-
data: null,
2423
path: null,
2524
label: null,
26-
liveUpdate: true,
27-
onUpdate: () => null,
28-
_onUpdateValue: () => null
25+
onUpdate: () => null
2926
};
3027

3128
constructor() {

src/components/Slider.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class Slider extends Component {
1414
min: PropTypes.number,
1515
max: PropTypes.number,
1616
width: PropTypes.number,
17-
onUpdate: PropTypes.func
17+
onUpdate: PropTypes.func.isRequired
1818
};
1919

2020
static defaultProps = {
@@ -23,8 +23,7 @@ export default class Slider extends Component {
2323
value: null,
2424
min: null,
2525
max: null,
26-
width: null,
27-
onUpdate: () => null
26+
width: null
2827
};
2928

3029
constructor() {

0 commit comments

Comments
 (0)