From 1e38cd840b34b8c19accb8377b9cfd7245064eef Mon Sep 17 00:00:00 2001 From: Niel Rohling Date: Thu, 7 Feb 2019 23:59:36 +0100 Subject: [PATCH] renaming --- src/components/Channel/ChannelList.scss | 1 + src/components/Channel/ChannelList.tsx | 41 +++++++++++++++++++ src/components/Channel/ChannelView.scss | 10 +++++ .../{channels => Channel}/ChannelView.tsx | 0 src/components/channels/Channellist.tsx | 20 --------- 5 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 src/components/Channel/ChannelList.scss create mode 100644 src/components/Channel/ChannelList.tsx create mode 100644 src/components/Channel/ChannelView.scss rename src/components/{channels => Channel}/ChannelView.tsx (100%) delete mode 100644 src/components/channels/Channellist.tsx 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}
; - } -}