Permalink
Browse files

Moved the logic for <ButtonWidget> into a new separate file 'webpack_…

…in/button_widget.jsx'.
  • Loading branch information...
maratbn committed Jul 2, 2018
1 parent 0155a62 commit 59750a035b276b3f48385c408f9dd37c910f21ed
Showing with 28 additions and 16 deletions.
  1. +27 −0 webpack_in/button_widget.jsx
  2. +1 −16 webpack_in/entry.jsx
@@ -0,0 +1,27 @@
// This file 'button_widget.jsx' is part of an example for building a multi-widget React front-end
// app step by step as outlined in the tutorial blog at
// http://maratbn.com/blogs/2018/07/02/react-multi-widget/
import PropTypes from 'prop-types';
import React from 'react';
class ButtonWidget extends React.Component {
render() {
return (
<button style={{ margin: '1em'}}
disabled={ this.props.isDisabled }
onClick={ this.props.onClick }>{ this.props.caption }</button>
);
}
}
ButtonWidget.propTypes = {
caption: PropTypes.string.isRequired,
isDisabled: PropTypes.bool,
onClick: PropTypes.func
};
export default ButtonWidget;
@@ -10,25 +10,10 @@ import PropTypes from 'prop-types';
import React from 'react';
import ReactDOM from 'react-dom';
import ButtonWidget from './button_widget.jsx';
import Styles from './styles.es';
class ButtonWidget extends React.Component {
render() {
return (
<button style={{ margin: '1em'}}
disabled={ this.props.isDisabled }
onClick={ this.props.onClick }>{ this.props.caption }</button>
);
}
}
ButtonWidget.propTypes = {
caption: PropTypes.string.isRequired,
isDisabled: PropTypes.bool,
onClick: PropTypes.func
};
class HelloWidget extends React.Component {
render() {
return (

0 comments on commit 59750a0

Please sign in to comment.