simple ChannelView
This commit is contained in:
parent
64d9992219
commit
b0756311d8
3 changed files with 46 additions and 2 deletions
|
@ -1,16 +1,21 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
import Channels from './components/channels/Channels';
|
|
||||||
import Header from './components/Header/Header';
|
import Header from './components/Header/Header';
|
||||||
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
public render() {
|
public render() {
|
||||||
|
const channel: Channel = {
|
||||||
|
id: 1,
|
||||||
|
name: 'test',
|
||||||
|
totalClients: -1,
|
||||||
|
neededSubscribePower: 0,
|
||||||
|
subchannels: [],
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className='App'>
|
<div className='App'>
|
||||||
<Header />
|
<Header />
|
||||||
<Channels />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
10
src/components/channels/ChannelView.css
Normal file
10
src/components/channels/ChannelView.css
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.channel-view {
|
||||||
|
background-color: green;
|
||||||
|
width: 20%;
|
||||||
|
height: auto;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.channel-view ul {
|
||||||
|
text-align: left
|
||||||
|
}
|
29
src/components/channels/ChannelView.tsx
Normal file
29
src/components/channels/ChannelView.tsx
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import './ChannelView.css';
|
||||||
|
|
||||||
|
export default class ChannelView extends Component<ChannelViewProps> {
|
||||||
|
render() {
|
||||||
|
const { channel } = this.props;
|
||||||
|
return (
|
||||||
|
<div className='channel-view'>
|
||||||
|
<h2>{channel.name}</h2>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<span>#{channel.id} </span>
|
||||||
|
{channel.name}
|
||||||
|
</li>
|
||||||
|
{channel.totalClients >= 0 && (
|
||||||
|
<li>
|
||||||
|
<span>Users online</span> {channel.totalClients}
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{channel.subchannels.length > 0 && (
|
||||||
|
<li>
|
||||||
|
<span>Subchannels:</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue