1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 09:13:19 +01:00

location.pathname refactor

This commit is contained in:
Matthias Kretschmann 2018-04-11 20:15:35 +02:00
parent 6583adf28c
commit 946c02f8af
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 8 additions and 4 deletions

View File

@ -5,11 +5,11 @@ import Social from './Social'
import { Logo } from '../atoms/Icons'
import './Header.scss'
const Header = ({ meta }) => {
const isHomepage = location.pathname === '/'
const Header = ({ meta, isHomepage}) => {
const classes = isHomepage ? 'header' : 'header header--minimal'
return <header className={classes}>
return (
<header className={classes}>
<Link className="header__name" to={'/'}>
<Logo className="header__logo" />
<h1 className="header__title">{meta.title}</h1>
@ -18,10 +18,12 @@ const Header = ({ meta }) => {
<Social meta={meta} minimal={!isHomepage} />
</header>
)
}
Header.propTypes = {
meta: PropTypes.object,
isHomepage: PropTypes.bool,
}
export default Header

View File

@ -8,10 +8,11 @@ import './index.scss'
const TemplateWrapper = props => {
const meta = props.data.allDataJson.edges[0].node
const isHomepage = props.location.pathname === '/'
return <div className="app">
<Head meta={meta} />
<Header meta={meta} />
<Header meta={meta} isHomepage={isHomepage} />
<FadeIn>{props.children()}</FadeIn>
<Footer meta={meta} />
</div>
@ -20,6 +21,7 @@ const TemplateWrapper = props => {
TemplateWrapper.propTypes = {
children: PropTypes.func,
data: PropTypes.object,
location: PropTypes.object,
}
export default TemplateWrapper