gatsby-starter-blog-forestry/layouts/default.js
2016-09-21 10:22:04 -07:00

73 lines
1.6 KiB
JavaScript

import React from 'react'
import { Link } from 'react-router'
import { Container } from 'react-responsive-grid'
import { prefixLink } from 'gatsby-helpers'
import { rhythm, adjustFontSizeToMSValue } from 'utils/typography'
class Template extends React.Component {
render () {
const { location, children } = this.props
let header
if (location.pathname === prefixLink('/')) {
header = (
<h1
style={{
...adjustFontSizeToMSValue(1.5),
marginBottom: rhythm(1.5),
marginTop: 0,
}}
>
<Link
style={{
boxShadow: 'none',
textDecoration: 'none',
color: 'inherit',
}}
to={prefixLink('/')}
>
{'TODO insert blog title here from query'}
</Link>
</h1>
)
} else {
header = (
<h3
style={{
fontFamily: 'Montserrat, sans-serif',
marginTop: 0,
}}
>
<Link
style={{
boxShadow: 'none',
textDecoration: 'none',
color: 'inherit',
}}
to={prefixLink('/')}
>
{'insert blog title here'}
</Link>
</h3>
)
}
return (
<Container
style={{
maxWidth: rhythm(24),
padding: `${rhythm(1.5)} ${rhythm(3/4)}`,
}}
>
{header}
{children}
</Container>
)
}
}
Template.propTypes = {
children: React.PropTypes.any,
location: React.PropTypes.object,
route: React.PropTypes.object,
}
export default Template