Home page load (#12)
* style: loading animation for homepage * fix: bug with category seletor
This commit is contained in:
parent
97c9a605de
commit
04f98428d8
|
@ -51,7 +51,7 @@ class CategorySelector extends React.Component {
|
||||||
return (
|
return (
|
||||||
<div ref={this.container}>
|
<div ref={this.container}>
|
||||||
<div
|
<div
|
||||||
style={open ? { display: 'block' } : { display: 'none' }}
|
style={open ? { visible: 'block' } : { display: 'none' }}
|
||||||
className={styles.open}
|
className={styles.open}
|
||||||
>
|
>
|
||||||
<div className={styles.openHeader}>
|
<div className={styles.openHeader}>
|
||||||
|
@ -77,7 +77,7 @@ class CategorySelector extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
style={open ? { display: 'none' } : { display: 'flex' }}
|
style={open ? { visibility: 'hidden' } : { visibility: 'visible' }}
|
||||||
className={[styles.closed, styles[category]].join(' ')}
|
className={[styles.closed, styles[category]].join(' ')}
|
||||||
type="button"
|
type="button"
|
||||||
onClick={this.toggle}
|
onClick={this.toggle}
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.closed {
|
.closed {
|
||||||
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: calculateRem(12) calculateRem(16);
|
margin: calculateRem(12) calculateRem(16);
|
||||||
padding: calculateRem(10) calculateRem(15);
|
padding: calculateRem(10) calculateRem(15);
|
||||||
|
|
|
@ -2,11 +2,38 @@ import React from 'react'
|
||||||
import RecentlyAdded from '../RecentlyAdded'
|
import RecentlyAdded from '../RecentlyAdded'
|
||||||
import Categories from '../Categories'
|
import Categories from '../Categories'
|
||||||
import Footer from '../Footer'
|
import Footer from '../Footer'
|
||||||
|
import styles from './Home.module.scss'
|
||||||
|
|
||||||
export default () => (
|
class Home extends React.Component {
|
||||||
<>
|
constructor(props) {
|
||||||
<Categories />
|
super(props)
|
||||||
<RecentlyAdded />
|
this.startLoadingAnimation = this.startLoadingAnimation.bind(this)
|
||||||
<Footer />
|
this.state = { didMount: false }
|
||||||
</>
|
}
|
||||||
)
|
|
||||||
|
componentDidMount() {
|
||||||
|
setTimeout(this.startLoadingAnimation, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
startLoadingAnimation() {
|
||||||
|
this.setState({ didMount: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { didMount } = this.state
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
didMount ? [styles.fade, styles.loaded].join(' ') : styles.fade
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Categories />
|
||||||
|
<RecentlyAdded />
|
||||||
|
<Footer />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Home
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
.fade {
|
||||||
|
filter: contrast(0.8) opacity(0) blur(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loaded {
|
||||||
|
filter: contrast(1) opacity(1) blur(0);
|
||||||
|
transition: filter 0.5s ease-in;
|
||||||
|
}
|
Loading…
Reference in New Issue