1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-29 00:58:00 +02:00
blog/src/templates/Page.jsx

31 lines
797 B
React
Raw Normal View History

2018-09-16 15:08:52 +02:00
import React from 'react'
import PropTypes from 'prop-types'
2018-11-07 01:15:41 +01:00
import Helmet from 'react-helmet'
import SEO from '../components/atoms/SEO'
2018-09-16 15:08:52 +02:00
import Layout from '../components/Layout'
import styles from './Page.module.scss'
2018-11-07 01:15:41 +01:00
const Page = ({ title, location, section, children, post }) => {
2018-09-16 15:08:52 +02:00
return (
2018-11-07 01:15:41 +01:00
<>
<Helmet title={title} />
<SEO slug={location.pathname} postSEO post={post} />
<Layout location={location}>
<h1 className={styles.pageTitle}>{title}</h1>
{section ? <section className={section}>{children}</section> : children}
</Layout>
</>
2018-09-16 15:08:52 +02:00
)
}
Page.propTypes = {
2018-09-16 15:45:06 +02:00
title: PropTypes.string.isRequired,
2018-09-16 15:08:52 +02:00
children: PropTypes.any.isRequired,
2018-10-17 19:45:44 +02:00
section: PropTypes.string,
2018-11-07 01:15:41 +01:00
location: PropTypes.object,
2019-01-01 19:32:49 +01:00
post: PropTypes.object
2018-09-16 15:08:52 +02:00
}
export default Page