Skip to content

Commit

Permalink
Commit 3 for Part3
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinmk committed Dec 7, 2016
1 parent 60ac053 commit a473d6a
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/components/SocketExampleComponents/SocketMessageLog.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
import React, {Component} from 'react';
import React, {Component, PropTypes} from 'react';
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 SocketMessageLog extends Component {
static propTypes = {
loaded: PropTypes.bool,
message: PropTypes.string,
connected: PropTypes.bool
}
render() {
const {loaded, message, connected} = this.props;
return (
<div>
<h3>Message log</h3>
<ul>
<li key="1" className="unstyled">
<span className="glyphicon glyphicon-arrow-right"></span>
Socket string
<span className="glyphicon glyphicon-arrow-right"> </span>
{message}
</li>
<li key="2" className="unstyled">
<span className="glyphicon glyphicon-arrow-left"></span>
[ECHO] Socket string
<span className="glyphicon glyphicon-arrow-left"> </span>
[ECHO] {message}
</li>
</ul>
<form className="form-inline">
<p></p>
<div className="form-group">
<input
className="form-control input-sm"
type="text"
ref="message_text"></input>
className="form-control input-sm"
type="text"
ref="message_text" readOnly = {(loaded === true) ? false : true}></input>
</div>
<button className="btn btn-primary btn-sm">
<button
className="btn btn-primary btn-sm"
disabled = {(connected === true) ? false : true}>
<i className="fa fa-sign-in"/> Send
</button>
</form>
Expand Down

0 comments on commit a473d6a

Please sign in to comment.