Skip to content

Commit

Permalink
Commit 2 for Part3
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinmk committed Dec 7, 2016
1 parent 0c984e3 commit 60ac053
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/components/SocketExampleComponents/SocketConnectionLog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React, {Component} from 'react';
import React, {Component, PropTypes} from 'react';

export default class SocketConnectionLog extends Component {
static propTypes = {
loaded: PropTypes.bool,
message: PropTypes.string,
connected: PropTypes.bool
}
render() {
const {loaded, message, connected} = this.props;
return (
<div>
<h3>Socket connection log</h3>
Expand All @@ -10,9 +16,11 @@ export default class SocketConnectionLog extends Component {
rows="1"
readOnly
placeholder="Waiting ..."
value="
value={'index =' + 0 + ', loaded = ' + loaded + ', message = ' + message + ', connected = ' + connected}/>
{/* value="
index = 2, loaded = true, message = Connected, connected = true
index = 1, loaded = false, message = Connecting..., connected = false"/>
*/}
<button className="btn btn-primary btn-sm">
<i className="fa fa-sign-in"/> Connect
</button>
Expand Down
20 changes: 17 additions & 3 deletions src/containers/SocketExample/SocketExamplePage.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import React, {Component} from 'react';
import React, {Component, PropTypes} from 'react';
import Helmet from 'react-helmet';
import {SocketConnectionLog} from 'components';
import {SocketMessageLog} from 'components';
import {connect} from 'react-redux';
import * as socketExampleActions from 'redux/modules/socketexamplemodule';

@connect(
state => ({
loaded: state.socketexample.loaded,
message: state.socketexample.message,
connected: state.socketexample.connected}),
socketExampleActions)

export default class SocketExamplePage extends Component {
static propTypes = {
loaded: PropTypes.bool,
message: PropTypes.string,
connected: PropTypes.bool
}
render() {
const {loaded, message, connected} = this.props;
return (
<div className="container">
<h1>Socket Exapmle Page</h1>
<Helmet title="Socket Exapmle Page"/>
<p>Sockets not connected</p>
<SocketConnectionLog />
<SocketConnectionLog loaded={loaded} message={message} connected={connected} />
<SocketMessageLog/>
</div>
);
Expand Down

0 comments on commit 60ac053

Please sign in to comment.