Adding react-helmet and starting on a Layout component
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Helmet } from 'react-helmet';
|
||||
|
||||
const Layout = ({ title, children }) => <React.Fragment>
|
||||
<Helmet>
|
||||
<title>{ title ? `Regexper - ${ title }` : 'Regexper' }</title>
|
||||
</Helmet>
|
||||
{ children }
|
||||
</React.Fragment>;
|
||||
|
||||
Layout.propTypes = {
|
||||
title: PropTypes.string,
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
PropTypes.node
|
||||
]).isRequired
|
||||
};
|
||||
|
||||
export default Layout;
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
import React from 'react';
|
||||
|
||||
const IndexPage = () => <div>Hello world</div>;
|
||||
import Layout from 'components/Layout';
|
||||
|
||||
const IndexPage = () => <Layout>
|
||||
<div>Hello world</div>
|
||||
</Layout>;
|
||||
|
||||
export default IndexPage;
|
||||
|
||||
Reference in New Issue
Block a user