File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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';
1010import React from 'react' ;
1111import ReactDOM from 'react-dom' ;
1212
13+ import ButtonWidget from './button_widget.jsx' ;
1314import Styles from './styles.es' ;
1415
1516
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-
3217class HelloWidget extends React . Component {
3318 render ( ) {
3419 return (
You can’t perform that action at this time.
0 commit comments