Created
January 29, 2019 17:52
-
-
Save DSchau/9402fad012a8e592334b47d40c1e4648 to your computer and use it in GitHub Desktop.
An example of a Bio component that can be used wherever
This file contains hidden or 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
| 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