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:
parent
6583adf28c
commit
946c02f8af
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user