Skip to content

Commit 48476a8

Browse files
committed
adding components
1 parent b0a74af commit 48476a8

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React, {Component} from "react";
2+
3+
class Channel extends Component{
4+
onClick(e){
5+
e.preventDefault();
6+
const {setChannel, channel} = this.props;
7+
setChannel(channel);
8+
}
9+
render(){
10+
const {channel} = this.props;
11+
return(
12+
<li>
13+
<a onClick={this.onClick.bind(this)}>
14+
{channel.name}
15+
</a>
16+
</li>
17+
)
18+
}
19+
}
20+
21+
Channel.propTypes = {
22+
channel: React.PropTypes.object.isRequired,
23+
setChannel: React.PropTypes.func.isRequired
24+
}
25+
26+
export default Channel;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React, {Component} from "react";
2+
import Channel from './Channel.jsx';
3+
4+
class ChannelList extends Component {
5+
render(){
6+
return(
7+
<ul>{
8+
this.props.channels.map( chan => {
9+
<Channel
10+
channel={chan}
11+
setChannel={this.props.setChannel}
12+
/>
13+
})
14+
}
15+
</ul>
16+
)
17+
}
18+
19+
}
20+
21+
ChannelList.propTypes = {
22+
channels: React.PropTypes.array.isRequired,
23+
setChannel: React.PropTypes.func.isRequired
24+
}
25+
26+
export default ChannelList;

rtsupport/package-lock.json

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rtsupport/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@babel/core": "^7.5.4",
1313
"@babel/preset-env": "^7.5.4",
1414
"babel-loader": "^8.0.6",
15+
"react": "^16.8.6",
1516
"webpack": "^4.35.3",
1617
"webpack-cli": "^3.3.5",
1718
"webpack-dev-server": "^3.7.2"

0 commit comments

Comments
 (0)