Merge pull request #126 from bradwoods/layout-name-convention-fix
Update layout to match convention
This commit is contained in:
commit
b6632e0e10
4 changed files with 75 additions and 4 deletions
71
src/components/Layout.js
Normal file
71
src/components/Layout.js
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { Link } from 'gatsby'
|
||||||
|
|
||||||
|
import { rhythm, scale } from '../utils/typography'
|
||||||
|
|
||||||
|
class Layout extends React.Component {
|
||||||
|
render() {
|
||||||
|
const { location, children } = this.props
|
||||||
|
const rootPath = `${__PATH_PREFIX__}/`
|
||||||
|
let header
|
||||||
|
|
||||||
|
if (location.pathname === rootPath) {
|
||||||
|
header = (
|
||||||
|
<h1
|
||||||
|
style={{
|
||||||
|
...scale(1.5),
|
||||||
|
marginBottom: rhythm(1.5),
|
||||||
|
marginTop: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Link
|
||||||
|
style={{
|
||||||
|
boxShadow: 'none',
|
||||||
|
textDecoration: 'none',
|
||||||
|
color: 'inherit',
|
||||||
|
}}
|
||||||
|
to={'/'}
|
||||||
|
>
|
||||||
|
Gatsby Starter Blog
|
||||||
|
</Link>
|
||||||
|
</h1>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
header = (
|
||||||
|
<h3
|
||||||
|
style={{
|
||||||
|
fontFamily: 'Montserrat, sans-serif',
|
||||||
|
marginTop: 0,
|
||||||
|
marginBottom: rhythm(-1),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Link
|
||||||
|
style={{
|
||||||
|
boxShadow: 'none',
|
||||||
|
textDecoration: 'none',
|
||||||
|
color: 'inherit',
|
||||||
|
}}
|
||||||
|
to={'/'}
|
||||||
|
>
|
||||||
|
Gatsby Starter Blog
|
||||||
|
</Link>
|
||||||
|
</h3>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
maxWidth: rhythm(24),
|
||||||
|
padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{header}
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Layout
|
||||||
|
|
@ -3,7 +3,7 @@ import { Link } from 'gatsby'
|
||||||
|
|
||||||
import { rhythm, scale } from '../utils/typography'
|
import { rhythm, scale } from '../utils/typography'
|
||||||
|
|
||||||
class Template extends React.Component {
|
class Layout extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const { location, children } = this.props
|
const { location, children } = this.props
|
||||||
const rootPath = `${__PATH_PREFIX__}/`
|
const rootPath = `${__PATH_PREFIX__}/`
|
||||||
|
|
@ -68,4 +68,4 @@ class Template extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Template
|
export default Layout
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import get from 'lodash/get'
|
||||||
import Helmet from 'react-helmet'
|
import Helmet from 'react-helmet'
|
||||||
|
|
||||||
import Bio from '../components/Bio'
|
import Bio from '../components/Bio'
|
||||||
import Layout from '../components/layout'
|
import Layout from '../components/Layout'
|
||||||
import { rhythm } from '../utils/typography'
|
import { rhythm } from '../utils/typography'
|
||||||
|
|
||||||
class BlogIndex extends React.Component {
|
class BlogIndex extends React.Component {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { Link,graphql } from 'gatsby'
|
||||||
import get from 'lodash/get'
|
import get from 'lodash/get'
|
||||||
|
|
||||||
import Bio from '../components/Bio'
|
import Bio from '../components/Bio'
|
||||||
import Layout from '../components/layout'
|
import Layout from '../components/Layout'
|
||||||
import { rhythm, scale } from '../utils/typography'
|
import { rhythm, scale } from '../utils/typography'
|
||||||
|
|
||||||
class BlogPostTemplate extends React.Component {
|
class BlogPostTemplate extends React.Component {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue