From 44fe7f52c4601a3cf92a3e7c01452d14ad1b4b1b Mon Sep 17 00:00:00 2001 From: Syafiq Hanafee Date: Wed, 28 Feb 2018 00:52:15 -0800 Subject: [PATCH 1/5] add tag pages and adjust config --- gatsby-node.js | 31 +++++++- package.json | 2 + src/cms/preview-templates/BlogPostPreview.js | 1 + src/layouts/all.sass | 15 ++++ ...ing-sense-of-the-scaas-new-flavor-wheel.md | 3 + ...-beginners-guide-to-brewing-with-chemex.md | 3 + ...maican-blue-mountain-in-store-next-week.md | 3 + src/pages/tags/index.js | 49 +++++++++++++ src/templates/blog-post.js | 19 ++++- src/templates/tags.js | 71 +++++++++++++++++++ static/admin/config.yml | 5 +- yarn.lock | 8 ++- 12 files changed, 205 insertions(+), 5 deletions(-) create mode 100644 src/pages/tags/index.js create mode 100644 src/templates/tags.js diff --git a/gatsby-node.js b/gatsby-node.js index 7688abe..92bd55f 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,3 +1,4 @@ +const _ = require('lodash') const path = require('path') const { createFilePath } = require('gatsby-source-filesystem') @@ -14,6 +15,7 @@ exports.createPages = ({ boundActionCreators, graphql }) => { slug } frontmatter { + tags templateKey } } @@ -26,10 +28,13 @@ exports.createPages = ({ boundActionCreators, graphql }) => { return Promise.reject(result.errors) } - result.data.allMarkdownRemark.edges.forEach(edge => { + const posts = result.data.allMarkdownRemark.edges + + posts.forEach(edge => { const id = edge.node.id createPage({ path: edge.node.fields.slug, + tags: edge.node.frontmatter.tags, component: path.resolve( `src/templates/${String(edge.node.frontmatter.templateKey)}.js` ), @@ -39,6 +44,30 @@ exports.createPages = ({ boundActionCreators, graphql }) => { }, }) }) + + // Tag pages: + let tags = [] + // Iterate through each post, putting all found tags into `tags` + posts.forEach(edge => { + if (_.get(edge, `node.frontmatter.tags`)) { + tags = tags.concat(edge.node.frontmatter.tags) + } + }) + // Eliminate duplicate tags + tags = _.uniq(tags) + + // Make tag pages + tags.forEach(tag => { + const tagPath = `/tags/${_.kebabCase(tag)}/` + + createPage({ + path: tagPath, + component: path.resolve(`src/templates/tags.js`), + context: { + tag, + }, + }) + }) }) } diff --git a/package.json b/package.json index 92fa01b..68793f4 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ "gatsby-source-filesystem": "^1.5.23", "gatsby-transformer-remark": "^1.7.33", "gatsby-transformer-sharp": "^1.6.21", + "lodash": "^4.17.5", + "lodash-webpack-plugin": "^0.11.4", "prop-types": "^15.6.0", "react": "^16.2.0", "react-helmet": "^5.2.0" diff --git a/src/cms/preview-templates/BlogPostPreview.js b/src/cms/preview-templates/BlogPostPreview.js index f3be58b..6d128c1 100644 --- a/src/cms/preview-templates/BlogPostPreview.js +++ b/src/cms/preview-templates/BlogPostPreview.js @@ -5,6 +5,7 @@ const BlogPostPreview = ({ entry, widgetFor }) => ( ) diff --git a/src/layouts/all.sass b/src/layouts/all.sass index 32e9e81..9e87d7b 100644 --- a/src/layouts/all.sass +++ b/src/layouts/all.sass @@ -7,6 +7,21 @@ $kaldi-red-invert: #fff $primary: $kaldi-red $primary-invert: $kaldi-red-invert +.content .taglist + list-style: none + margin-bottom: 0 + margin-left: 0 + margin-right: 1.5rem + margin-top: 1.5rem + display: flex + flex-wrap: wrap + justify-content: left + align-items: center + li + padding: 0 2rem 1rem 0 + margin-bottom: 1.5rem + margin-top: 0 + // Helper Classes .full-width-image-container width: 100vw diff --git a/src/pages/blog/2016-12-17-making-sense-of-the-scaas-new-flavor-wheel.md b/src/pages/blog/2016-12-17-making-sense-of-the-scaas-new-flavor-wheel.md index 5d3036a..ca4b004 100644 --- a/src/pages/blog/2016-12-17-making-sense-of-the-scaas-new-flavor-wheel.md +++ b/src/pages/blog/2016-12-17-making-sense-of-the-scaas-new-flavor-wheel.md @@ -3,6 +3,9 @@ templateKey: blog-post title: Making sense of the SCAA’s new Flavor Wheel date: 2016-12-17T15:04:10.000Z description: The Coffee Taster’s Flavor Wheel, the official resource used by coffee tasters, has been revised for the first time this year. +tags: + - flavor + - tasting --- ![flavor wheel](/img/flavor_wheel.jpg) diff --git a/src/pages/blog/2017-01-04-a-beginners-guide-to-brewing-with-chemex.md b/src/pages/blog/2017-01-04-a-beginners-guide-to-brewing-with-chemex.md index 8889c48..f06dd8a 100644 --- a/src/pages/blog/2017-01-04-a-beginners-guide-to-brewing-with-chemex.md +++ b/src/pages/blog/2017-01-04-a-beginners-guide-to-brewing-with-chemex.md @@ -3,6 +3,9 @@ templateKey: blog-post title: A beginners’ guide to brewing with Chemex date: 2017-01-04T15:04:10.000Z description: Brewing with a Chemex probably seems like a complicated, time-consuming ordeal, but once you get used to the process, it becomes a soothing ritual that's worth the effort every time. +tags: + - brewing + - chemex --- ![chemex](/img/chemex.jpg) diff --git a/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md b/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md index 9007f16..14abfbb 100644 --- a/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md +++ b/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md @@ -5,6 +5,9 @@ date: 2017-01-04T15:04:10.000Z description: >- We’re proud to announce that we’ll be offering a small batch of Jamaica Blue Mountain coffee beans in our store next week. +tags: + - jamaica + - green beans --- We expect the shipment of a limited quantity of green beans next Monday. We’ll be offering the roasted beans from Tuesday, but quantities are limited, so be quick. diff --git a/src/pages/tags/index.js b/src/pages/tags/index.js new file mode 100644 index 0000000..06580a7 --- /dev/null +++ b/src/pages/tags/index.js @@ -0,0 +1,49 @@ +import React from 'react' +import { kebabCase } from 'lodash' +import Helmet from 'react-helmet' +import Link from 'gatsby-link' + +const TagsPage = ({ + data: { allMarkdownRemark: { group }, site: { siteMetadata: { title } } }, +}) => ( +
+ +
+
+
+

Tags

+
    + {group.map(tag => ( +
  • + + {tag.fieldValue} ({tag.totalCount}) + +
  • + ))} +
+
+
+
+
+) + +export default TagsPage + +export const tagPageQuery = graphql` + query TagsQuery { + site { + siteMetadata { + title + } + } + allMarkdownRemark(limit: 1000) { + group(field: frontmatter___tags) { + fieldValue + totalCount + } + } + } +` diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index f90af05..06e4cdc 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -1,11 +1,14 @@ import React from 'react' +import { kebabCase } from 'lodash' import Helmet from 'react-helmet' +import Link from 'gatsby-link' import Content, { HTMLContent } from '../components/Content' export const BlogPostTemplate = ({ content, contentComponent, description, + tags, title, helmet, }) => { @@ -22,6 +25,18 @@ export const BlogPostTemplate = ({

{description}

+ {tags && tags.length ? ( +
+

Tags

+
    + {tags.map(tag => ( +
  • + {tag} +
  • + ))} +
+
+ ) : null} @@ -37,7 +52,8 @@ export default props => { content={post.html} contentComponent={HTMLContent} description={post.frontmatter.description} - helmet={} + helmet={} + tags={post.frontmatter.tags} title={post.frontmatter.title} /> ) @@ -52,6 +68,7 @@ export const pageQuery = graphql` date(formatString: "MMMM DD, YYYY") title description + tags } } } diff --git a/src/templates/tags.js b/src/templates/tags.js new file mode 100644 index 0000000..0879a7b --- /dev/null +++ b/src/templates/tags.js @@ -0,0 +1,71 @@ +import React from 'react' +import Helmet from 'react-helmet' +import Link from 'gatsby-link' + +class TagRoute extends React.Component { + render() { + const posts = this.props.data.allMarkdownRemark.edges + const postLinks = posts.map(post => ( +
  • + +

    {post.node.frontmatter.title}

    + +
  • + )) + const tag = this.props.pathContext.tag + const title = this.props.data.site.siteMetadata.title + const totalCount = this.props.data.allMarkdownRemark.totalCount + const tagHeader = `${totalCount} post${ + totalCount === 1 ? '' : 's' + } tagged with “${tag}”` + + return ( +
    + +
    +
    +
    +

    {tagHeader}

    +
      {postLinks}
    +

    + Browse all tags +

    +
    +
    +
    +
    + ) + } +} + +export default TagRoute + +export const tagPageQuery = graphql` + query TagPage($tag: String) { + site { + siteMetadata { + title + } + } + allMarkdownRemark( + limit: 1000 + sort: { fields: [frontmatter___date], order: DESC } + filter: { frontmatter: { tags: { in: [$tag] } } } + ) { + totalCount + edges { + node { + fields { + slug + } + frontmatter { + title + } + } + } + } + } +` diff --git a/static/admin/config.yml b/static/admin/config.yml index 67b8bda..020c0db 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -17,18 +17,19 @@ collections: - {label: "Publish Date", name: "date", widget: "datetime"} - {label: "Description", name: "description", widget: "text"} - {label: "Body", name: "body", widget: "markdown"} + - {label: "Tags", name: "tags", widget: "list"} - name: "pages" label: "Pages" files: - - file: "src/pages/about/about.md" + - file: "src/pages/about/index.md" label: "About" name: "about" fields: - {label: "Template Key", name: "templateKey", widget: "hidden", default: "about-page"} - {label: "Title", name: "title", widget: "string"} - {label: "Body", name: "body", widget: "markdown"} - - file: "src/pages/product/product.md" + - file: "src/pages/products/index.md" label: "Products Page" name: "products" fields: diff --git a/yarn.lock b/yarn.lock index 16707c1..2ceb48f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5761,6 +5761,12 @@ lodash-id@^0.14.0: version "0.14.0" resolved "https://registry.yarnpkg.com/lodash-id/-/lodash-id-0.14.0.tgz#baf48934e543a1b5d6346f8c84698b1a8c803896" +lodash-webpack-plugin@^0.11.4: + version "0.11.4" + resolved "https://registry.yarnpkg.com/lodash-webpack-plugin/-/lodash-webpack-plugin-0.11.4.tgz#6c3ecba3d4b8d24b53940b63542715c5ed3c4ac5" + dependencies: + lodash "^4.17.4" + lodash._basecopy@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" @@ -5965,7 +5971,7 @@ lodash@3.10.1: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" -lodash@4, lodash@^4.0.0, lodash@^4.1.0, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1, lodash@~4.17.4: +lodash@4, lodash@^4.0.0, lodash@^4.1.0, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1, lodash@~4.17.4: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" From b5dd8c9be5d67dc98b9de96ce825b1a26a0ad0f2 Mon Sep 17 00:00:00 2001 From: Syafiq Hanafee Date: Mon, 5 Mar 2018 14:50:47 -0800 Subject: [PATCH 2/5] add flavor and tasting tags to Jamaican Blue post --- ...-small-batch-of-jamaican-blue-mountain-in-store-next-week.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md b/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md index 14abfbb..9f899b0 100644 --- a/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md +++ b/src/pages/blog/2017-01-04-just-in-small-batch-of-jamaican-blue-mountain-in-store-next-week.md @@ -8,6 +8,8 @@ description: >- tags: - jamaica - green beans + - flavor + - tasting --- We expect the shipment of a limited quantity of green beans next Monday. We’ll be offering the roasted beans from Tuesday, but quantities are limited, so be quick. From b63e5787f0a62fd252eaa5eb13adc26f6a559fb0 Mon Sep 17 00:00:00 2001 From: Syafiq Hanafee Date: Wed, 14 Mar 2018 15:38:46 +0700 Subject: [PATCH 3/5] feat(prop-types): add prop-types validation to components Fixes #26 --- src/cms/preview-templates/AboutPagePreview.js | 8 ++++ src/cms/preview-templates/BlogPostPreview.js | 8 ++++ .../preview-templates/ProductPagePreview.js | 8 ++++ src/components/Content.js | 17 +++++++-- src/components/Features.js | 10 +++++ src/components/Pricing.js | 14 ++++++- src/components/Testimonials.js | 14 ++++++- src/pages/index.js | 9 +++++ src/templates/about-page.js | 15 +++++++- src/templates/blog-post.js | 21 ++++++++++- src/templates/product-page.js | 37 ++++++++++++++++++- 11 files changed, 152 insertions(+), 9 deletions(-) diff --git a/src/cms/preview-templates/AboutPagePreview.js b/src/cms/preview-templates/AboutPagePreview.js index 71b9d32..413a6da 100644 --- a/src/cms/preview-templates/AboutPagePreview.js +++ b/src/cms/preview-templates/AboutPagePreview.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import { AboutPageTemplate } from '../../templates/about-page' const AboutPagePreview = ({ entry, widgetFor }) => ( @@ -8,4 +9,11 @@ const AboutPagePreview = ({ entry, widgetFor }) => ( /> ) +AboutPagePreview.propTypes = { + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + widgetFor: PropTypes.func, +} + export default AboutPagePreview diff --git a/src/cms/preview-templates/BlogPostPreview.js b/src/cms/preview-templates/BlogPostPreview.js index f3be58b..ca3505a 100644 --- a/src/cms/preview-templates/BlogPostPreview.js +++ b/src/cms/preview-templates/BlogPostPreview.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import { BlogPostTemplate } from '../../templates/blog-post' const BlogPostPreview = ({ entry, widgetFor }) => ( @@ -9,4 +10,11 @@ const BlogPostPreview = ({ entry, widgetFor }) => ( /> ) +BlogPostPreview.propTypes = { + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + widgetFor: PropTypes.func, +} + export default BlogPostPreview diff --git a/src/cms/preview-templates/ProductPagePreview.js b/src/cms/preview-templates/ProductPagePreview.js index 0173650..7970041 100644 --- a/src/cms/preview-templates/ProductPagePreview.js +++ b/src/cms/preview-templates/ProductPagePreview.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import { ProductPageTemplate } from '../../templates/product-page' const ProductPagePreview = ({ entry, getAsset }) => { @@ -45,4 +46,11 @@ const ProductPagePreview = ({ entry, getAsset }) => { ) } +ProductPagePreview.propTypes = { + entry: PropTypes.shape({ + getIn: PropTypes.func, + }), + getAsset: PropTypes.func, +} + export default ProductPagePreview diff --git a/src/components/Content.js b/src/components/Content.js index 24ee52e..289e571 100644 --- a/src/components/Content.js +++ b/src/components/Content.js @@ -1,8 +1,19 @@ import React from 'react' +import PropTypes from 'prop-types' -export default ({ content, className }) => ( -
    {content}
    -) export const HTMLContent = ({ content, className }) => (
    ) + +const Content = ({ content, className }) => ( +
    {content}
    +) + +Content.propTypes = { + content: PropTypes.string, + className: PropTypes.string, +} + +HTMLContent.propTypes = Content.propTypes + +export default Content diff --git a/src/components/Features.js b/src/components/Features.js index 1b0778c..15c19b2 100644 --- a/src/components/Features.js +++ b/src/components/Features.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' const FeatureGrid = ({ gridItems }) => (
    @@ -15,4 +16,13 @@ const FeatureGrid = ({ gridItems }) => (
    ) +FeatureGrid.propTypes = { + gridItems: PropTypes.arrayOf( + PropTypes.shape({ + image: PropTypes.string, + text: PropTypes.string, + }) + ), +} + export default FeatureGrid diff --git a/src/components/Pricing.js b/src/components/Pricing.js index df49b26..d07efb7 100644 --- a/src/components/Pricing.js +++ b/src/components/Pricing.js @@ -1,6 +1,7 @@ import React from 'react' +import PropTypes from 'prop-types' -export default ({ data }) => ( +const Pricing = ({ data }) => (
    {data.map(price => (
    @@ -24,3 +25,14 @@ export default ({ data }) => ( ))}
    ) + +Pricing.propTypes = { + data: PropTypes.shape({ + plan: PropTypes.string, + price: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + description: PropTypes.string, + items: PropTypes.array, + }), +} + +export default Pricing diff --git a/src/components/Testimonials.js b/src/components/Testimonials.js index 171303d..05b15c4 100644 --- a/src/components/Testimonials.js +++ b/src/components/Testimonials.js @@ -1,6 +1,7 @@ import React from 'react' +import PropTypes from 'prop-types' -export default ({ testimonials }) => ( +const Testimonials = ({ testimonials }) => (
    {testimonials.map(testimonial => (
    @@ -13,3 +14,14 @@ export default ({ testimonials }) => ( ))}
    ) + +Testimonials.propTypes = { + testimonials: PropTypes.arrayOf( + PropTypes.shape({ + quote: PropTypes.string, + author: PropTypes.string, + }) + ), +} + +export default Testimonials diff --git a/src/pages/index.js b/src/pages/index.js index f519327..512870e 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import Link from 'gatsby-link' export default class IndexPage extends React.Component { @@ -43,6 +44,14 @@ export default class IndexPage extends React.Component { } } +IndexPage.propTypes = { + data: PropTypes.shape({ + allMarkdownRemark: PropTypes.shape({ + edges: PropTypes.array, + }), + }), +} + export const pageQuery = graphql` query IndexQuery { allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) { diff --git a/src/templates/about-page.js b/src/templates/about-page.js index b36f822..6db9aa7 100644 --- a/src/templates/about-page.js +++ b/src/templates/about-page.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import Content, { HTMLContent } from '../components/Content' export const AboutPageTemplate = ({ title, content, contentComponent }) => { @@ -22,7 +23,13 @@ export const AboutPageTemplate = ({ title, content, contentComponent }) => { ) } -export default ({ data }) => { +AboutPageTemplate.propTypes = { + title: PropTypes.string.isRequired, + content: PropTypes.string, + contentComponent: PropTypes.instanceOf(React.Component), +} + +const AboutPage = ({ data }) => { const { markdownRemark: post } = data return ( @@ -34,6 +41,12 @@ export default ({ data }) => { ) } +AboutPage.propTypes = { + data: PropTypes.object.isRequired, +} + +export default AboutPage + export const aboutPageQuery = graphql` query AboutPage($id: String!) { markdownRemark(id: { eq: $id }) { diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index f90af05..3adf19e 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import Helmet from 'react-helmet' import Content, { HTMLContent } from '../components/Content' @@ -29,8 +30,16 @@ export const BlogPostTemplate = ({ ) } -export default props => { - const { markdownRemark: post } = props.data +BlogPostTemplate.propTypes = { + content: PropTypes.string.isRequired, + contentComponent: PropTypes.instanceOf(React.Component), + description: PropTypes.string, + title: PropTypes.string, + helmet: PropTypes.instanceOf(Helmet), +} + +const BlogPost = ({ data }) => { + const { markdownRemark: post } = data return ( { ) } +BlogPost.propTypes = { + data: PropTypes.shape({ + data: PropTypes.object, + }), +} + +export default BlogPost + export const pageQuery = graphql` query BlogPostByID($id: String!) { markdownRemark(id: { eq: $id }) { diff --git a/src/templates/product-page.js b/src/templates/product-page.js index 3e5ac9d..d556fbb 100644 --- a/src/templates/product-page.js +++ b/src/templates/product-page.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import Features from '../components/Features' import Testimonials from '../components/Testimonials' import Pricing from '../components/Pricing' @@ -104,7 +105,31 @@ export const ProductPageTemplate = ({ ) -export default ({ data }) => { +ProductPageTemplate.propTypes = { + image: PropTypes.string, + title: PropTypes.string, + heading: PropTypes.string, + description: PropTypes.string, + intro: PropTypes.shape({ + blurbs: PropTypes.array, + }), + main: PropTypes.shape({ + heading: PropTypes.string, + description: PropTypes.string, + image1: PropTypes.object, + image2: PropTypes.object, + image3: PropTypes.object, + }), + testimonials: PropTypes.array, + fullImage: PropTypes.string, + pricing: PropTypes.shape({ + heading: PropTypes.string, + description: PropTypes.string, + plans: PropTypes.array, + }), +} + +const ProductPage = ({ data }) => { const { frontmatter } = data.markdownRemark return ( @@ -122,6 +147,16 @@ export default ({ data }) => { ) } +ProductPage.propTypes = { + data: PropTypes.shape({ + markdownRemark: PropTypes.shape({ + frontmatter: PropTypes.object, + }), + }), +} + +export default ProductPage + export const productPageQuery = graphql` query ProductPage($id: String!) { markdownRemark(id: { eq: $id }) { From 0e6774d2fe8ab80ed77005c2887ed4b2d1aba7a6 Mon Sep 17 00:00:00 2001 From: Syafiq Hanafee Date: Wed, 14 Mar 2018 17:04:02 +0700 Subject: [PATCH 4/5] fix: incorect types --- src/components/Pricing.js | 14 ++++++++------ src/templates/about-page.js | 2 +- src/templates/blog-post.js | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/Pricing.js b/src/components/Pricing.js index d07efb7..6677a65 100644 --- a/src/components/Pricing.js +++ b/src/components/Pricing.js @@ -27,12 +27,14 @@ const Pricing = ({ data }) => ( ) Pricing.propTypes = { - data: PropTypes.shape({ - plan: PropTypes.string, - price: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - description: PropTypes.string, - items: PropTypes.array, - }), + data: PropTypes.arrayOf( + PropTypes.shape({ + plan: PropTypes.string, + price: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + description: PropTypes.string, + items: PropTypes.array, + }) + ), } export default Pricing diff --git a/src/templates/about-page.js b/src/templates/about-page.js index 6db9aa7..a662a62 100644 --- a/src/templates/about-page.js +++ b/src/templates/about-page.js @@ -26,7 +26,7 @@ export const AboutPageTemplate = ({ title, content, contentComponent }) => { AboutPageTemplate.propTypes = { title: PropTypes.string.isRequired, content: PropTypes.string, - contentComponent: PropTypes.instanceOf(React.Component), + contentComponent: PropTypes.func, } const AboutPage = ({ data }) => { diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index 3adf19e..c5de9e7 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -32,7 +32,7 @@ export const BlogPostTemplate = ({ BlogPostTemplate.propTypes = { content: PropTypes.string.isRequired, - contentComponent: PropTypes.instanceOf(React.Component), + contentComponent: PropTypes.func, description: PropTypes.string, title: PropTypes.string, helmet: PropTypes.instanceOf(Helmet), @@ -54,7 +54,7 @@ const BlogPost = ({ data }) => { BlogPost.propTypes = { data: PropTypes.shape({ - data: PropTypes.object, + markdownRemark: PropTypes.object, }), } From 816174d66189409c66f6f5ade1be30a45db2d611 Mon Sep 17 00:00:00 2001 From: Syafiq Hanafee Date: Fri, 23 Mar 2018 20:01:37 -0400 Subject: [PATCH 5/5] increment patch number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 68793f4..47e06cc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gatsby-starter-netlify-cms", "description": "Example Gatsby, and Netlify CMS project", - "version": "1.1.0", + "version": "1.1.1", "author": "Austin Green", "dependencies": { "bulma": "^0.6.0",