Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import React from "react"
  2. import Link from "gatsby-link"
  3. import { Container } from "react-responsive-grid"
  4.  
  5. import { rhythm, scale } from "../utils/typography"
  6.  
  7. class Template extends React.Component {
  8. render() {
  9. const { location, children } = this.props
  10. let header
  11. if (location.pathname === "/") {
  12. header = (
  13. <h1 >
  14. <Link to={"/"}>
  15. Gatsby Starter Blog
  16. </Link>
  17. </h1>
  18. )
  19. } else {
  20. header = (
  21. <h3>
  22. <Link to={"/"} >
  23. Gatsby Starter Blog
  24. </Link>
  25. </h3>
  26. )
  27. }
  28. return (
  29. <Container>
  30. {header}
  31. {children()}
  32. </Container>
  33. )
  34. }
  35. }
  36.  
  37. Template.propTypes = {
  38. children: React.PropTypes.function,
  39. location: React.PropTypes.object,
  40. route: React.PropTypes.object,
  41. }
  42.  
  43. export default Template
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement