1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00
docs/src/templates/Doc.jsx

48 lines
1.2 KiB
JavaScript

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { graphql } from 'gatsby'
import Layout from '../components/Layout'
import Sidebar from '../components/Sidebar'
export default class DocTemplate extends Component {
static propTypes = {
data: PropTypes.object.isRequired,
location: PropTypes.object.isRequired
}
render() {
const post = this.props.data.markdownRemark
return (
<Layout location={this.props.location}>
<Sidebar
location={this.props.location}
sidebar={post.frontmatter.sidebar}
/>
<h1>{post.frontmatter.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.html }} />
</Layout>
)
}
}
export const pageQuery = graphql`
query DocBySlug($slug: String!) {
site {
siteMetadata {
title
}
}
markdownRemark(fields: { slug: { eq: $slug } }) {
id
excerpt
html
frontmatter {
title
sidebar
}
}
}
`