From 0bdb846703434f204d2a379ba35f720a91f555f1 Mon Sep 17 00:00:00 2001 From: hitsuji_no_shippo Date: Mon, 27 Jan 2020 22:27:07 +0900 Subject: [PATCH] reafctor(article): rename prop from `post` to `article` (close #171) In `article` component --- CHANGELOG.adoc | 9 ++++++--- src/components/Article/Footer.js | 8 ++++---- src/components/Article/Header/index.js | 26 +++++++++++++------------- src/components/Article/index.js | 16 ++++++++-------- src/templates/blog-post.js | 8 ++++---- 5 files changed, 35 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 6ba3310..3cf64a9 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -4,9 +4,10 @@ :author: {author-name} :!email: {author-email} :revnumber: Branch refactor/collect-codes-to-one-directory-and-update-prop-types \ - v1.0.0 (Base v1.72.0) -:revdate: 2020-01-28T12:56:52+0900 -:revremark: Add log that delete useless comments. + v1.1.0 (Base v1.72.0) +:revdate: 2020-01-28T12:59:58+0900 +:revremark: Add log that \ + rename prop from `post` to `article` in `article` component. :doctype: article :description: gatsby-simple-blog-with-asciidoctor Change Log :title: @@ -117,6 +118,8 @@ ifndef::env-github[:icons: font] -- * Collect `LanguageBar` component codes. (close link:{issues-url}/155[#155^]) * Delete useless comments. (close link:{issues-url}/170[#170^]) +* Rename prop from `post` to `article` in `article` component. + (close link:{issues-url}/171[#171^]) === Docs diff --git a/src/components/Article/Footer.js b/src/components/Article/Footer.js index c38f25f..5c03764 100644 --- a/src/components/Article/Footer.js +++ b/src/components/Article/Footer.js @@ -5,16 +5,16 @@ import minimatch from 'minimatch'; import { repository, articles } from 'config' -const Footer = ({post}) => { +const Footer = ({article}) => { if (!(articles.dir && articles.filePath && (repository.url || articles.isOtherRepositroy))) { return null; } const filePath = (() => { - let value = post; + let value = article; - articles.filePath[post.internal.type].split('.').some(path => { + articles.filePath[article.internal.type].split('.').some(path => { value = Object.prototype.hasOwnProperty.call(value, path) ? value[path] : null; @@ -52,7 +52,7 @@ const Footer = ({post}) => { } Footer.propTypes = { - post: PropTypes.object.isRequired, + article: PropTypes.object.isRequired, }; export default Footer; diff --git a/src/components/Article/Header/index.js b/src/components/Article/Header/index.js index 35aa673..8c58689 100644 --- a/src/components/Article/Header/index.js +++ b/src/components/Article/Header/index.js @@ -9,10 +9,10 @@ import { rhythm, scale } from 'utils/typography'; import TranslationsLink from './TranslationsLink'; -const Header = ({post, slug, translationsLink, languageContexts}) => { +const Header = ({article, slug, translationsLink, languageContexts}) => { return (
-

{post.document.title}

+

{article.document.title}

{ }} >

- {post.pageAttributes.tags && - } { } Header.propTypes = { - post: PropTypes.object.isRequired, + article: PropTypes.object.isRequired, slug: PropTypes.string.isRequired, translationsLink: PropTypes.array.isRequired, languageContexts: PropTypes.object.isRequired, diff --git a/src/components/Article/index.js b/src/components/Article/index.js index 5d3fcff..b974323 100644 --- a/src/components/Article/index.js +++ b/src/components/Article/index.js @@ -5,23 +5,23 @@ import Header from './Header' import LightWeightMarkup from './LightweightMarkup' import Footer from './Footer' -const Article = ({post, slug, translationsLink, languageContexts}) => { +const Article = ({article, slug, translationsLink, languageContexts}) => { return (
- -
+ +
); } Article.propTypes = { - post: PropTypes.object.isRequired, + article: PropTypes.object.isRequired, slug: PropTypes.string.isRequired, translationsLink: PropTypes.array.isRequired, languageContexts: PropTypes.object.isRequired, diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index 46e7200..5a3d41c 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -33,10 +33,10 @@ function BlogPostTemplate({ data, pageContext, location }) { }} />