From e5db8b5907500f37af8933ca874efb24d4d35a25 Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Fri, 1 Dec 2017 00:28:53 -0600 Subject: [PATCH] fix(channels): channels makeover --- app/routes/channels/components/Channels.js | 69 ++++++++++++++------ app/routes/channels/components/Channels.scss | 54 +++++++++++---- 2 files changed, 92 insertions(+), 31 deletions(-) diff --git a/app/routes/channels/components/Channels.js b/app/routes/channels/components/Channels.js index dd65f8ea..21abad24 100644 --- a/app/routes/channels/components/Channels.js +++ b/app/routes/channels/components/Channels.js @@ -12,6 +12,14 @@ import ChannelForm from 'components/ChannelForm' import styles from './Channels.scss' class Channels extends Component { + constructor(props) { + super(props) + + this.state = { + refreshing: false + } + } + componentWillMount() { const { fetchChannels, fetchPeers } = this.props @@ -48,24 +56,50 @@ class Channels extends Component { channelFormProps } = this.props - const refreshClicked = (event) => { + const refreshClicked = event => { + // turn the spinner on + this.setState({ refreshing: true }) + // store event in icon so we dont get an error when react clears it - const icon = event.currentTarget + let icon = this.refs.repeat.childNodes - // fetch channels + // fetch peers fetchChannels() - // clear animation after the second so we can reuse it - setTimeout(() => { icon.style.animation = '' }, 1000) + // wait for the svg to appear as child + let svgTimeout = setTimeout(() => { + if (icon[0].tagName === 'svg') { + // spin icon for 1 sec + icon[0].style.animation = 'spin 1000ms linear 1' + clearTimeout(svgTimeout) + } + }, 1) - // spin icon for 1 sec - icon.style.animation = 'spin 1000ms linear 1' + // clear animation after the second so we can reuse it + let refreshTimeout = setTimeout(() => { + icon[0].style.animation = '' + this.setState({ refreshing: false }) + clearTimeout(refreshTimeout) + }, 1000) } return (
+
+
+
+

Channels

+
+
+
+
+ Create new channel +
+
+
+
-
-
-
- Create new channel -
-
-
@@ -102,11 +129,15 @@ class Channels extends Component { }
-
- +
+ + { + this.state.refreshing ? + + : + 'Refresh' + } +
diff --git a/app/routes/channels/components/Channels.scss b/app/routes/channels/components/Channels.scss index c5f7a515..f70a37c6 100644 --- a/app/routes/channels/components/Channels.scss +++ b/app/routes/channels/components/Channels.scss @@ -5,8 +5,9 @@ } .search { - height: 75px; + height: 55px; padding: 2px 25px; + border-top: 1px solid $darkgrey; border-bottom: 1px solid $darkgrey; background: $white; @@ -18,8 +19,8 @@ .label { width: 5%; - line-height: 70px; - font-size: 25px; + line-height: 50px; + font-size: 20px; text-align: center; cursor: pointer; } @@ -30,15 +31,39 @@ padding: 0; border: 0; border-radius: 0; - height: 68px; - font-size: 18px; + height: 50px; + font-size: 16px; } } .header { display: flex; flex-direction: row; - justify-content: flex-end; + justify-content: space-between; + background: $lightgrey; + + .titleContainer { + padding: 20px 40px; + + .left { + padding: 10px 0; + + h1 { + text-transform: uppercase; + font-size: 26px; + margin-right: 5px; + } + } + } + + .createChannelContainer { + padding: 20px 40px; + + .createChannelButton { + font-size: 14px; + margin-left: 10px; + } + } } .filtersContainer { @@ -46,7 +71,7 @@ display: flex; flex-direction: row; justify-content: space-between; - padding: 0 40px; + padding: 20px 40px; h2, h2 span { color: $bluegrey; @@ -89,17 +114,22 @@ } } } - + .refreshContainer { - color: $bluegrey; + text-align: right; + cursor: pointer; - &:hover { - cursor: pointer; - color: lighten($bluegrey, 10%); + .refresh { + text-decoration: underline; + + svg { + font-size: 12px; + } } } } + .layoutsContainer { padding: 40px;