質問編集履歴
2
頂いた回答に沿って修正したコードを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -243,3 +243,141 @@
|
|
243
243
|
</html>
|
244
244
|
|
245
245
|
```
|
246
|
+
|
247
|
+
2019/8/19/8:51追記
|
248
|
+
|
249
|
+
```ここに言語を入力
|
250
|
+
|
251
|
+
<html>
|
252
|
+
|
253
|
+
<head>
|
254
|
+
|
255
|
+
<meta http-equiv="content-type" charset="utf-8">
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
|
262
|
+
|
263
|
+
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
|
264
|
+
|
265
|
+
<script src="https://unpkg.com/@material-ui/core@latest/umd/material-ui.production.min.js"></script>
|
266
|
+
|
267
|
+
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
</head>
|
272
|
+
|
273
|
+
<body>
|
274
|
+
|
275
|
+
<div id="root">root</div>
|
276
|
+
|
277
|
+
<script type="text/babel">
|
278
|
+
|
279
|
+
class CheckAndReset extends React.Component{
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
constructor() {
|
284
|
+
|
285
|
+
super()
|
286
|
+
|
287
|
+
this.state = {
|
288
|
+
|
289
|
+
open: false
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
}
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
handleToggle() {
|
298
|
+
|
299
|
+
this.setState({
|
300
|
+
|
301
|
+
open: !this.state.open
|
302
|
+
|
303
|
+
})
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
render(){
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
const{Button,Checkbox}=MaterialUI;
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
return(
|
320
|
+
|
321
|
+
<div>
|
322
|
+
|
323
|
+
<div>Hello.everyone!!!!!</div>
|
324
|
+
|
325
|
+
リセットする。→
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
<Checkbox
|
330
|
+
|
331
|
+
disableRipple={false}
|
332
|
+
|
333
|
+
value="checkedA"
|
334
|
+
|
335
|
+
inputProps={{ 'aria-label': 'Checkbox A' }}
|
336
|
+
|
337
|
+
onChange={()=>this.handleToggle()}
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
icon={<CheckBoxOutlineBlankIcon style={{ fontSize: 50 }} />}
|
342
|
+
|
343
|
+
checkedIcon={<CheckBoxIcon style={{ fontSize: 50 }} />}
|
344
|
+
|
345
|
+
/>
|
346
|
+
|
347
|
+
{this.state.open ? <div><p>リセットボタンを押すと全てのカウントがリセットされます。</p>
|
348
|
+
|
349
|
+
<p>よろしければ押してください。</p><Button variant="contained" color="primary" style={{fontSize: '4em'}}>
|
350
|
+
|
351
|
+
カウントリセット
|
352
|
+
|
353
|
+
</Button></div>
|
354
|
+
|
355
|
+
: null}
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
</div>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
)
|
366
|
+
|
367
|
+
}
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
ReactDOM.render(<CheckAndReset />,document.getElementById('root'));
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</script>
|
378
|
+
|
379
|
+
</body>
|
380
|
+
|
381
|
+
</html>
|
382
|
+
|
383
|
+
```
|
1
全ソースコードを提示しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -107,3 +107,139 @@
|
|
107
107
|
https://material-ui.com/api/checkbox/
|
108
108
|
|
109
109
|
を見てもいまいち指定の仕方がはっきりしないのですが、css周りの操作など基本的なmaterialUIの使い方についてまとまってるサイト・書籍などありますでしょうか?
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
追記:すべてのソースを以下に示します。
|
114
|
+
|
115
|
+
```ここに言語を入力
|
116
|
+
|
117
|
+
<html>
|
118
|
+
|
119
|
+
<head>
|
120
|
+
|
121
|
+
<meta http-equiv="content-type" charset="utf-8">
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
|
128
|
+
|
129
|
+
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
|
130
|
+
|
131
|
+
<script src="https://unpkg.com/@material-ui/core@latest/umd/material-ui.production.min.js"></script>
|
132
|
+
|
133
|
+
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</head>
|
138
|
+
|
139
|
+
<body>
|
140
|
+
|
141
|
+
<div id="root">root</div>
|
142
|
+
|
143
|
+
<script type="text/babel">
|
144
|
+
|
145
|
+
class CheckAndReset extends React.Component{
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
constructor() {
|
150
|
+
|
151
|
+
super()
|
152
|
+
|
153
|
+
this.state = {
|
154
|
+
|
155
|
+
open: false
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
handleToggle() {
|
164
|
+
|
165
|
+
this.setState({
|
166
|
+
|
167
|
+
open: !this.state.open
|
168
|
+
|
169
|
+
})
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
render(){
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
const{Button,Checkbox}=MaterialUI;
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
return(
|
186
|
+
|
187
|
+
<div>
|
188
|
+
|
189
|
+
<div>Hello.everyone!!!!!</div>
|
190
|
+
|
191
|
+
リセットする。→
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<Checkbox
|
196
|
+
|
197
|
+
disableRipple={false}
|
198
|
+
|
199
|
+
value="checkedA"
|
200
|
+
|
201
|
+
inputProps={{ 'aria-label': 'Checkbox A' }}
|
202
|
+
|
203
|
+
onChange={()=>this.handleToggle()}
|
204
|
+
|
205
|
+
style={{width: 50,height: 50}}
|
206
|
+
|
207
|
+
/>
|
208
|
+
|
209
|
+
{this.state.open ? <div><p>リセットボタンを押すと全てのカウントがリセットされます。</p>
|
210
|
+
|
211
|
+
<p>よろしければ押してください。</p><Button variant="contained" color="primary" style={{fontSize: '4em'}}>
|
212
|
+
|
213
|
+
カウントリセット
|
214
|
+
|
215
|
+
</Button></div>
|
216
|
+
|
217
|
+
: null}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
)
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
ReactDOM.render(<CheckAndReset />,document.getElementById('root'));
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</script>
|
240
|
+
|
241
|
+
</body>
|
242
|
+
|
243
|
+
</html>
|
244
|
+
|
245
|
+
```
|