text: import React from 'react'
  import { Helmet } from 'react-helmet'
  import { Link, graphql } from 'gatsby'
  import Layout from '../components/Layout'
  
  class TechnologyRoute 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 technology = this.props.pageContext.technology
      const title = this.props.data.site.siteMetadata.title
      const totalCount = this.props.data.allMarkdownRemark.totalCount
      const technologyHeader = `${totalCount} post${
        totalCount === 1 ? '' : 's'
      } tagged with “${technology}”`
  
      return (
        <Layout>
          <section className="section">
            <Helmet title={`${technology} | ${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">{technologyHeader}</h3>
                  <ul className="technologylist">{postLinks}</ul>
                  <p>
                    <Link to="/technologies/">Browse all technologies</Link>
                  </p>
                </div>
              </div>
            </div>
          </section>
        </Layout>
      )
    }
  }
  
  export default TechnologyRoute
  
  export const technologyPageQuery = graphql`
    query TechnologyPage($technology: String) {
      site {
        siteMetadata {
          title
        }
      }
      allMarkdownRemark(
        limit: 1000
        sort: { fields: [frontmatter___date], order: DESC }
        filter: { frontmatter: { technologies: { in: [$technology] } } }
      ) {
        totalCount
        edges {
          node {
            fields {
              slug
            }
            frontmatter {
              title
            }
          }
        }
      }
    }
  `
  