diff --git a/src/components/Channel/ChannelList.scss b/src/components/Channel/ChannelList.scss new file mode 100644 index 0000000..bc04ac0 --- /dev/null +++ b/src/components/Channel/ChannelList.scss @@ -0,0 +1 @@ +.channelList li span {} diff --git a/src/components/Channel/ChannelList.tsx b/src/components/Channel/ChannelList.tsx new file mode 100644 index 0000000..546884b --- /dev/null +++ b/src/components/Channel/ChannelList.tsx @@ -0,0 +1,41 @@ +import React, { Component } from 'react'; +import ChannelService from '../../services/chanel'; + +import './ChannelList.scss'; + +export default class Channellist extends Component { + service: ChannelService; + constructor(props: any) { + super(props); + this.state = { + loaded: false, + channels: [], + }; + this.service = new ChannelService(); + } + + componentDidMount() { + fetch('http://haveachin.de:1888/v1/channels') + .then(res => res.json()) + .then(data => this.setState({ channels: data, loaded: true })) + .catch(e => console.log(e)); + } + public render() { + const { loaded, channels } = this.state; + console.log(this.state); + if (!loaded) { + return
Loading...
; + } else { + return ( + + ); + } + } +} diff --git a/src/components/Channel/ChannelView.scss b/src/components/Channel/ChannelView.scss new file mode 100644 index 0000000..9e43fba --- /dev/null +++ b/src/components/Channel/ChannelView.scss @@ -0,0 +1,10 @@ +.channel-view { + background-color: green; + width: 20%; + height: auto; + margin: auto; +} + +.channel-view ul { + text-align: left +} diff --git a/src/components/channels/ChannelView.tsx b/src/components/Channel/ChannelView.tsx similarity index 100% rename from src/components/channels/ChannelView.tsx rename to src/components/Channel/ChannelView.tsx diff --git a/src/components/channels/Channellist.tsx b/src/components/channels/Channellist.tsx deleted file mode 100644 index 73fcb9e..0000000 --- a/src/components/channels/Channellist.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React, { Component } from 'react'; - -export default class Channellist extends Component { - constructor(props: any) { - super(props); - this.state = { - data: 'Loading...', - }; - } - - componentDidMount() { - fetch('https://ts.cliffbreak.de/v1/channels') - .then(response => response.json()) - .then(data => this.setState({ data })); - } - public render() { - const { data } = this.state; - return
{data}
; - } -}