-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into prop-types
- Loading branch information
Showing
12 changed files
with
205 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } } }, | ||
}) => ( | ||
<section className="section"> | ||
<Helmet title={`Tags | ${title}`} /> | ||
<div className="container content"> | ||
<div className="columns"> | ||
<div | ||
className="column is-10 is-offset-1" | ||
style={{ marginBottom: '6rem' }} | ||
> | ||
<h1 className="title is-size-2 is-bold-light">Tags</h1> | ||
<ul className="taglist"> | ||
{group.map(tag => ( | ||
<li key={tag.fieldValue}> | ||
<Link to={`/tags/${kebabCase(tag.fieldValue)}/`}> | ||
{tag.fieldValue} ({tag.totalCount}) | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
) | ||
|
||
export default TagsPage | ||
|
||
export const tagPageQuery = graphql` | ||
query TagsQuery { | ||
site { | ||
siteMetadata { | ||
title | ||
} | ||
} | ||
allMarkdownRemark(limit: 1000) { | ||
group(field: frontmatter___tags) { | ||
fieldValue | ||
totalCount | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 => ( | ||
<li key={post.node.fields.slug}> | ||
<Link to={post.node.fields.slug}> | ||
<h2 className="is-size-2">{post.node.frontmatter.title}</h2> | ||
</Link> | ||
</li> | ||
)) | ||
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 ( | ||
<section className="section"> | ||
<Helmet title={`${tag} | ${title}`} /> | ||
<div className="container content"> | ||
<div className="columns"> | ||
<div | ||
className="column is-10 is-offset-1" | ||
style={{ marginBottom: '6rem' }} | ||
> | ||
<h3 className="title is-size-4 is-bold-light">{tagHeader}</h3> | ||
<ul className="taglist">{postLinks}</ul> | ||
<p> | ||
<Link to="/tags/">Browse all tags</Link> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 @@ [email protected]: | |
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" | ||
|
||
|