@@ -10,16 +10,7 @@ import PropTypes from 'prop-types';
1010import React from 'react' ;
1111import ReactDOM from 'react-dom' ;
1212
13-
14- const objStyleCommon = {
15- margin : '1em' ,
16- border : 'solid 2px green' ,
17- textAlign : 'center'
18- } ;
19-
20- const objStyleContent = {
21- padding : '1em'
22- } ;
13+ import Styles from './styles.es' ;
2314
2415
2516class ButtonWidget extends React . Component {
@@ -41,7 +32,7 @@ ButtonWidget.propTypes = {
4132class HelloWidget extends React . Component {
4233 render ( ) {
4334 return (
44- < div style = { { ...objStyleCommon , ...objStyleContent } } >
35+ < div style = { { ...Styles . common , ...Styles . content } } >
4536 Hello! I'm a React app!!
4637 </ div >
4738 ) ;
@@ -59,8 +50,8 @@ class TextWidget extends React.Component {
5950
6051 render ( ) {
6152 return (
62- < div style = { objStyleCommon } >
63- < div style = { objStyleContent } > { this . state . text } </ div >
53+ < div style = { Styles . common } >
54+ < div style = { Styles . content } > { this . state . text } </ div >
6455 < ButtonWidget caption = "Change text..."
6556 onClick = { ( ) => {
6657 const strTextNew = prompt ( "Please enter text to display:" ,
@@ -163,8 +154,8 @@ class ListWidget extends React.Component {
163154 "" ) ;
164155
165156 return (
166- < div style = { objStyleCommon } >
167- < div style = { objStyleContent } >
157+ < div style = { Styles . common } >
158+ < div style = { Styles . content } >
168159 < ul style = { { display : 'inline-block' , textAlign : 'left' , listStyleType : 'none' } } >
169160 { this . state . items . map ( ( objItem , index ) => (
170161 < ListItem key = { objItem . id }
@@ -387,7 +378,7 @@ class ColorSelector extends React.Component {
387378 } ;
388379
389380 return (
390- < div style = { objStyleCommon } >
381+ < div style = { Styles . common } >
391382 < div style = { { margin : '1em auto' ,
392383 width : '70%' ,
393384 height : '3em' ,
0 commit comments