Skip to content

Instantly share code, notes, and snippets.

@DSchau
Created January 29, 2019 17:52
Show Gist options
  • Select an option

  • Save DSchau/9402fad012a8e592334b47d40c1e4648 to your computer and use it in GitHub Desktop.

Select an option

Save DSchau/9402fad012a8e592334b47d40c1e4648 to your computer and use it in GitHub Desktop.
An example of a Bio component that can be used wherever
import React from 'react'
import { StaticQuery, graphql } from 'gatsby'
export default function Bio() {
return (
<StaticQuery
query={graphql`
{
file({ relativePath: { regex: "/bio.md/" }}) {
childMarkdownRemark {
frontmatter {
name
}
html
}
}
}
`}
render={data => (
<div className="bio">
<h1 className="bio-name">{data.file.childMarkdownRemark.frontmatter.name}</h1>
<div className="bio-description" dangerouslySetInnerHTML={{ __html: data.file.childMarkdownRemark.html }} />
</div>
)}
/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment