Skip to content

Commit f93ef4e

Browse files
committed
add euiformrow to some examples
1 parent 667e427 commit f93ef4e

4 files changed

Lines changed: 88 additions & 43 deletions

File tree

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import React, { Component } from 'react';
1+
import React, { Component, Fragment } from 'react';
22

3-
import { EuiDualRange } from '../../../../src/components';
3+
import {
4+
EuiDualRange,
5+
EuiFormRow,
6+
EuiSpacer,
7+
} from '../../../../src/components';
48

59
import makeId from '../../../../src/components/form/form_row/make_id';
610

@@ -10,6 +14,7 @@ export default class extends Component {
1014

1115
this.state = {
1216
value: ['', ''],
17+
value2: ['20', '150'],
1318
};
1419
}
1520

@@ -19,17 +24,39 @@ export default class extends Component {
1924
});
2025
};
2126

27+
onChange2 = value => {
28+
this.setState({
29+
value2: value,
30+
});
31+
};
32+
2233
render() {
2334
return (
24-
<EuiDualRange
25-
id={makeId()}
26-
min={-100}
27-
max={200}
28-
step={10}
29-
value={this.state.value}
30-
onChange={this.onChange}
31-
showLabels
32-
/>
35+
<Fragment>
36+
<EuiFormRow label="Dual range">
37+
<EuiDualRange
38+
id={makeId()}
39+
min={-100}
40+
max={200}
41+
step={10}
42+
value={this.state.value}
43+
onChange={this.onChange}
44+
showLabels
45+
/>
46+
</EuiFormRow>
47+
48+
<EuiSpacer size="xl" />
49+
50+
<EuiDualRange
51+
id={makeId()}
52+
min={-100}
53+
max={200}
54+
step={10}
55+
value={this.state.value2}
56+
onChange={this.onChange2}
57+
showLabels
58+
/>
59+
</Fragment>
3360
);
3461
}
3562
}

src-docs/src/views/range/input.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import React, { Component, Fragment } from 'react';
22

3-
import { EuiRange, EuiSpacer, EuiDualRange } from '../../../../src/components';
3+
import {
4+
EuiRange,
5+
EuiSpacer,
6+
EuiDualRange,
7+
EuiFormRow,
8+
} from '../../../../src/components';
49

510
import makeId from '../../../../src/components/form/form_row/make_id';
611

@@ -29,21 +34,25 @@ export default class extends Component {
2934
render() {
3035
return (
3136
<Fragment>
32-
<EuiRange
33-
id={makeId()}
34-
value={this.state.value}
35-
onChange={this.onChange}
36-
showInput
37-
/>
37+
<EuiFormRow label="Single">
38+
<EuiRange
39+
id={makeId()}
40+
value={this.state.value}
41+
onChange={this.onChange}
42+
showInput
43+
/>
44+
</EuiFormRow>
3845

3946
<EuiSpacer size="xl" />
4047

41-
<EuiDualRange
42-
id={makeId()}
43-
value={this.state.dualValue}
44-
onChange={this.onDualChange}
45-
showInput
46-
/>
48+
<EuiFormRow label="Dual">
49+
<EuiDualRange
50+
id={makeId()}
51+
value={this.state.dualValue}
52+
onChange={this.onDualChange}
53+
showInput
54+
/>
55+
</EuiFormRow>
4756
</Fragment>
4857
);
4958
}

src-docs/src/views/range/input_only.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import React, { Component, Fragment } from 'react';
22

3-
import { EuiRange, EuiSpacer, EuiDualRange } from '../../../../src/components';
3+
import {
4+
EuiRange,
5+
EuiSpacer,
6+
EuiDualRange,
7+
EuiFormRow,
8+
} from '../../../../src/components';
49

510
import makeId from '../../../../src/components/form/form_row/make_id';
611

@@ -63,14 +68,16 @@ export default class extends Component {
6368

6469
<EuiSpacer size="xl" />
6570

66-
<EuiRange
67-
id={makeId()}
68-
value={this.state.value}
69-
onChange={this.onChange}
70-
compressed
71-
showInput="inputWithPopover"
72-
showLabels
73-
/>
71+
<EuiFormRow label="With label">
72+
<EuiRange
73+
id={makeId()}
74+
value={this.state.value}
75+
onChange={this.onChange}
76+
compressed
77+
showInput="inputWithPopover"
78+
showLabels
79+
/>
80+
</EuiFormRow>
7481

7582
<EuiSpacer size="xl" />
7683

src-docs/src/views/range/range.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component, Fragment } from 'react';
22

3-
import { EuiRange, EuiSpacer } from '../../../../src/components';
3+
import { EuiRange, EuiSpacer, EuiFormRow } from '../../../../src/components';
44

55
import makeId from '../../../../src/components/form/form_row/make_id';
66

@@ -22,15 +22,17 @@ export default class extends Component {
2222
render() {
2323
return (
2424
<Fragment>
25-
<EuiRange
26-
id={makeId()}
27-
min={100}
28-
max={200}
29-
step={0.05}
30-
value={this.state.value}
31-
onChange={this.onChange}
32-
showLabels
33-
/>
25+
<EuiFormRow label="Single range">
26+
<EuiRange
27+
id={makeId()}
28+
min={100}
29+
max={200}
30+
step={0.05}
31+
value={this.state.value}
32+
onChange={this.onChange}
33+
showLabels
34+
/>
35+
</EuiFormRow>
3436

3537
<EuiSpacer size="xl" />
3638

0 commit comments

Comments
 (0)