import {object} from 'prop-types'; import ExampleList from './ExampleList'; import React, {Component, Fragment} from 'react'; import styled from 'react-emotion'; const Wrapper = styled('div')({ display: 'flex' }); const Sidebar = styled('div')({ marginRight: '1em' }); const Content = styled('div')({ minWidth: 300, flexGrow: 1 }); const Embed = styled('iframe')({ margin: 0, padding: 0, height: 350, width: '100%' }); const Aside = styled('aside')({ textAlign: 'right', fontSize: '0.75em' }); const Block = styled('pre')({ overflow: 'auto' }); class Example extends Component { render() { const example = this.props.data.sitePage.context; return (

{example.frontmatter.title}

script

{example.js}

markup

{example.html} {example.css && (

style

{example.css}
)}
); } } Example.propTypes = { data: object.isRequired }; export const query = graphql` query ExampleQuery($slug: String!) { sitePage(context: {slug: {eq: $slug}}) { context { slug frontmatter { title } embedUrl html js css } } } `; export default Example;