1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-07-01 06:01:48 +02:00
portfolio/src/components/Layout.jsx

42 lines
1.1 KiB
React
Raw Normal View History

2018-09-14 20:22:57 +02:00
import React, { PureComponent, Fragment } from 'react'
import PropTypes from 'prop-types'
2018-09-14 20:22:57 +02:00
import posed, { PoseGroup } from 'react-pose'
2018-09-14 20:58:49 +02:00
import { fadeIn } from './atoms/Transitions'
2018-07-18 21:00:50 +02:00
import Head from './molecules/Head'
import Header from './organisms/Header'
import Footer from './organisms/Footer'
2018-06-23 15:50:02 +02:00
import styles from './Layout.module.scss'
2018-09-14 20:58:49 +02:00
const timeout = 250
2018-09-14 20:22:57 +02:00
export default class Layout extends PureComponent {
static propTypes = {
children: PropTypes.any.isRequired,
location: PropTypes.object.isRequired
}
2018-09-14 20:22:57 +02:00
render() {
const { children, location } = this.props
const isHomepage = location.pathname === '/'
2018-09-14 20:58:49 +02:00
const RoutesContainer = posed.div(fadeIn)
2018-09-14 20:22:57 +02:00
return (
<Fragment>
<Head />
<PoseGroup animateOnMount={true}>
2018-09-14 20:58:49 +02:00
<RoutesContainer
key={location.pathname}
delay={timeout}
delayChildren={timeout}
>
2018-09-19 19:50:41 +02:00
<Header minimal={!isHomepage} />
2018-09-14 20:22:57 +02:00
<main className={styles.screen}>{children}</main>
</RoutesContainer>
</PoseGroup>
<Footer />
</Fragment>
)
}
}