Skip to content

Commit

Permalink
Integrate SiteMetadata component into existing pages
Browse files Browse the repository at this point in the history
All currently existing pages will now include the implemented metadata
tags in the `<head>`.

GH-101
  • Loading branch information
arcticicestudio committed Dec 22, 2018
1 parent 42bc8d0 commit f0afd74
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 13 deletions.
35 changes: 35 additions & 0 deletions src/data/pages/shared/propTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides shared prop types for pages.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://reactjs.org/docs/typechecking-with-proptypes.html
* @since 0.4.0
*/

import PropTypes from "prop-types";

const locationPropTypes = {
/**
* The `location` object provided by React/Reach Router.
*
* @see https://reach.tech/router/api/Router
*/
location: PropTypes.shape({
/**
* The name of the current route/path.
*/
pathname: PropTypes.string
}).isRequired
};

/* eslint-disable-next-line import/prefer-default-export */
export { locationPropTypes };
9 changes: 6 additions & 3 deletions src/pages/404.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import React from "react";

import { locationPropTypes } from "data/pages/shared/propTypes";
import BaseLayout from "layouts/core/BaseLayout";
import { SectionLanding } from "organisms/page/404";

Expand All @@ -19,10 +20,12 @@ import { SectionLanding } from "organisms/page/404";
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/
const Docs = props => (
<BaseLayout {...props}>
const HttpStatus404 = ({ location: { pathname } }) => (
<BaseLayout pathName={pathname}>
<SectionLanding />
</BaseLayout>
);

export default Docs;
HttpStatus404.propTypes = locationPropTypes;

export default HttpStatus404;
7 changes: 5 additions & 2 deletions src/pages/blog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import React from "react";

import { locationPropTypes } from "data/pages/shared/propTypes";
import BaseLayout from "layouts/core/BaseLayout";
import { SectionBlogPosts } from "organisms/page/blog";

Expand All @@ -19,10 +20,12 @@ import { SectionBlogPosts } from "organisms/page/blog";
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/
const Blog = props => (
<BaseLayout {...props}>
const Blog = ({ location: { pathname } }) => (
<BaseLayout pathName={pathname}>
<SectionBlogPosts />
</BaseLayout>
);

Blog.propTypes = locationPropTypes;

export default Blog;
7 changes: 5 additions & 2 deletions src/pages/community.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import React from "react";

import { locationPropTypes } from "data/pages/shared/propTypes";
import BaseLayout from "layouts/core/BaseLayout";
import { SectionLanding } from "organisms/page/community";

Expand All @@ -19,10 +20,12 @@ import { SectionLanding } from "organisms/page/community";
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/
const Community = props => (
<BaseLayout {...props}>
const Community = ({ location: { pathname } }) => (
<BaseLayout pathName={pathname}>
<SectionLanding />
</BaseLayout>
);

Community.propTypes = locationPropTypes;

export default Community;
7 changes: 5 additions & 2 deletions src/pages/docs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import React from "react";

import { locationPropTypes } from "data/pages/shared/propTypes";
import BaseLayout from "layouts/core/BaseLayout";
import { SectionLanding } from "organisms/page/docs";

Expand All @@ -19,10 +20,12 @@ import { SectionLanding } from "organisms/page/docs";
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/
const Docs = props => (
<BaseLayout {...props}>
const Docs = ({ location: { pathname } }) => (
<BaseLayout pathName={pathname}>
<SectionLanding />
</BaseLayout>
);

Docs.propTypes = locationPropTypes;

export default Docs;
7 changes: 5 additions & 2 deletions src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import React from "react";

import { locationPropTypes } from "data/pages/shared/propTypes";
import BaseLayout from "layouts/core/BaseLayout";
import { SectionHero } from "organisms/page/landing";

Expand All @@ -19,10 +20,12 @@ import { SectionHero } from "organisms/page/landing";
* @author Sven Greb <[email protected]>
* @since 0.1.0
*/
const Landing = () => (
<BaseLayout>
const Landing = ({ location: { pathname } }) => (
<BaseLayout pathName={pathname}>
<SectionHero />
</BaseLayout>
);

Landing.propTypes = locationPropTypes;

export default Landing;
7 changes: 5 additions & 2 deletions src/pages/ports.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import React from "react";

import { locationPropTypes } from "data/pages/shared/propTypes";
import BaseLayout from "layouts/core/BaseLayout";
import { SectionLanding } from "organisms/page/ports";

Expand All @@ -19,10 +20,12 @@ import { SectionLanding } from "organisms/page/ports";
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/
const Ports = props => (
<BaseLayout {...props}>
const Ports = ({ location: { pathname } }) => (
<BaseLayout pathName={pathname}>
<SectionLanding />
</BaseLayout>
);

Ports.propTypes = locationPropTypes;

export default Ports;

0 comments on commit f0afd74

Please sign in to comment.