Browse Source

fix(channels): channels makeover

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
e5db8b5907
  1. 69
      app/routes/channels/components/Channels.js
  2. 54
      app/routes/channels/components/Channels.scss

69
app/routes/channels/components/Channels.js

@ -12,6 +12,14 @@ import ChannelForm from 'components/ChannelForm'
import styles from './Channels.scss' import styles from './Channels.scss'
class Channels extends Component { class Channels extends Component {
constructor(props) {
super(props)
this.state = {
refreshing: false
}
}
componentWillMount() { componentWillMount() {
const { fetchChannels, fetchPeers } = this.props const { fetchChannels, fetchPeers } = this.props
@ -48,24 +56,50 @@ class Channels extends Component {
channelFormProps channelFormProps
} = this.props } = 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 // 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() fetchChannels()
// clear animation after the second so we can reuse it // wait for the svg to appear as child
setTimeout(() => { icon.style.animation = '' }, 1000) 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 // clear animation after the second so we can reuse it
icon.style.animation = 'spin 1000ms linear 1' let refreshTimeout = setTimeout(() => {
icon[0].style.animation = ''
this.setState({ refreshing: false })
clearTimeout(refreshTimeout)
}, 1000)
} }
return ( return (
<div className={`${styles.container} ${viewType === 1 && styles.graphview}`}> <div className={`${styles.container} ${viewType === 1 && styles.graphview}`}>
<ChannelForm {...channelFormProps} /> <ChannelForm {...channelFormProps} />
<header className={styles.header}>
<div className={styles.titleContainer}>
<div className={styles.left}>
<h1>Channels</h1>
</div>
</div>
<div className={styles.createChannelContainer}>
<div className={`buttonPrimary ${styles.newChannelButton}`} onClick={openChannelForm}>
Create new channel
</div>
</div>
</header>
<div className={styles.search}> <div className={styles.search}>
<label className={`${styles.label} ${styles.input}`} htmlFor='channelSearch'> <label className={`${styles.label} ${styles.input}`} htmlFor='channelSearch'>
<MdSearch /> <MdSearch />
@ -79,13 +113,6 @@ class Channels extends Component {
id='channelSearch' id='channelSearch'
/> />
</div> </div>
<header className={styles.header}>
<div className={styles.createChannelContainer}>
<div className={`buttonPrimary ${styles.newChannelButton}`} onClick={openChannelForm}>
Create new channel
</div>
</div>
</header>
<div className={styles.filtersContainer}> <div className={styles.filtersContainer}>
<section> <section>
@ -102,11 +129,15 @@ class Channels extends Component {
} }
</ul> </ul>
</section> </section>
<section className={`${styles.refreshContainer} hint--left`} data-hint='Refresh your channels list'> <section className={styles.refreshContainer}>
<FaRepeat <span className={styles.refresh} onClick={refreshClicked} ref='repeat'>
style={{ verticalAlign: 'baseline' }} {
onClick={refreshClicked} this.state.refreshing ?
/> <FaRepeat />
:
'Refresh'
}
</span>
</section> </section>
</div> </div>

54
app/routes/channels/components/Channels.scss

@ -5,8 +5,9 @@
} }
.search { .search {
height: 75px; height: 55px;
padding: 2px 25px; padding: 2px 25px;
border-top: 1px solid $darkgrey;
border-bottom: 1px solid $darkgrey; border-bottom: 1px solid $darkgrey;
background: $white; background: $white;
@ -18,8 +19,8 @@
.label { .label {
width: 5%; width: 5%;
line-height: 70px; line-height: 50px;
font-size: 25px; font-size: 20px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
@ -30,15 +31,39 @@
padding: 0; padding: 0;
border: 0; border: 0;
border-radius: 0; border-radius: 0;
height: 68px; height: 50px;
font-size: 18px; font-size: 16px;
} }
} }
.header { .header {
display: flex; display: flex;
flex-direction: row; 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 { .filtersContainer {
@ -46,7 +71,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
padding: 0 40px; padding: 20px 40px;
h2, h2 span { h2, h2 span {
color: $bluegrey; color: $bluegrey;
@ -89,17 +114,22 @@
} }
} }
} }
.refreshContainer { .refreshContainer {
color: $bluegrey; text-align: right;
cursor: pointer;
&:hover { .refresh {
cursor: pointer; text-decoration: underline;
color: lighten($bluegrey, 10%);
svg {
font-size: 12px;
}
} }
} }
} }
.layoutsContainer { .layoutsContainer {
padding: 40px; padding: 40px;

Loading…
Cancel
Save