Commit 59750a0 1 parent 0155a62 commit 59750a0 Copy full SHA for 59750a0
File tree 2 files changed +28
-16
lines changed
2 files changed +28
-16
lines changed Original file line number Diff line number Diff line change
1
+ // This file 'button_widget.jsx' is part of an example for building a multi-widget React front-end
2
+ // app step by step as outlined in the tutorial blog at
3
+ // http://maratbn.com/blogs/2018/07/02/react-multi-widget/
4
+
5
+
6
+ import PropTypes from 'prop-types' ;
7
+ import React from 'react' ;
8
+
9
+
10
+ class ButtonWidget extends React . Component {
11
+ render ( ) {
12
+ return (
13
+ < button style = { { margin : '1em' } }
14
+ disabled = { this . props . isDisabled }
15
+ onClick = { this . props . onClick } > { this . props . caption } </ button >
16
+ ) ;
17
+ }
18
+ }
19
+
20
+ ButtonWidget . propTypes = {
21
+ caption : PropTypes . string . isRequired ,
22
+ isDisabled : PropTypes . bool ,
23
+ onClick : PropTypes . func
24
+ } ;
25
+
26
+
27
+ export default ButtonWidget ;
Original file line number Diff line number Diff line change @@ -10,25 +10,10 @@ import PropTypes from 'prop-types';
10
10
import React from 'react' ;
11
11
import ReactDOM from 'react-dom' ;
12
12
13
+ import ButtonWidget from './button_widget.jsx' ;
13
14
import Styles from './styles.es' ;
14
15
15
16
16
- class ButtonWidget extends React . Component {
17
- render ( ) {
18
- return (
19
- < button style = { { margin : '1em' } }
20
- disabled = { this . props . isDisabled }
21
- onClick = { this . props . onClick } > { this . props . caption } </ button >
22
- ) ;
23
- }
24
- }
25
-
26
- ButtonWidget . propTypes = {
27
- caption : PropTypes . string . isRequired ,
28
- isDisabled : PropTypes . bool ,
29
- onClick : PropTypes . func
30
- } ;
31
-
32
17
class HelloWidget extends React . Component {
33
18
render ( ) {
34
19
return (
You can’t perform that action at this time.
0 commit comments