-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
109 lines (100 loc) · 2.73 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import React from "react";
import ReactDOM from "react-dom";
import "antd/dist/antd.css";
import "./index.css";
import { Row, Col, Slider } from "antd";
class App extends React.Component {
q1 = {};
q2 = {};
q3 = {};
constructor() {
super();
this.state = {
q1Key: 1,
q2Key: 1,
q3Key: 2
};
[1, 2, 3, 4, 5, 6].forEach((value, i) => {
this.q1[i] = value;
});
[1, 2, 3, 4, 5, 6].forEach((value, i) => {
this.q2[i] = value;
});
[1, 2, 3, 4, 5, 6].forEach((value, i) => {
this.q3[i] = value;
});
}
onQ1Change = q1Key => {
this.setState({ q1Key });
};
onQ2Change = q2Key => {
this.setState({ q2Key });
};
onQ3Change = q3Key => {
this.setState({ q3Key });
};
render() {
const { q1Key, q2Key, q3Key } = this.state;
const cols = [];
const q3 = this.q3[q3Key];
let colCode = "";
for (let i = 0; i < q3; i++) {
cols.push(
<Col key={i.toString()} span={24 / q3}>
<div>Column</div>
</Col>
);
colCode += ` <Col span={${24 / q3}} />\n`;
}
return (
<div>
<div style={{ marginBottom: 16 }}>
<span style={{ marginRight: 6 }}>
1. In the last one year, were/ was your colleagues/ workplace
supportive of your chronic condition(s) management efforts in the
way you needed it?
</span>
<div style={{ width: "50%" }}>
<Slider
min={0}
max={Object.keys(this.q1).length - 1}
value={q1Key}
onChange={this.onQ1Change}
marks={this.q1}
step={null}
/>
</div>
<span style={{ marginRight: 6 }}>
2. In the last one month, did you feel that all your efforts to
manage your chronic condition(s) were useless?{" "}
</span>
<div style={{ width: "50%" }}>
<Slider
min={0}
max={Object.keys(this.q2).length - 1}
value={q2Key}
onChange={this.onQ2Change}
marks={this.q2}
step={null}
/>
</div>
<span style={{ marginRight: 6 }}>
3. In the last one month, did you feel scared when you thought about
living with chronic condition(s)?
</span>
<div style={{ width: "50%" }}>
<Slider
min={0}
max={Object.keys(this.q3).length - 1}
value={q3Key}
onChange={this.onQ3Change}
marks={this.q3}
step={null}
/>
</div>
</div>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById("container"));