graphene/docs/wrappers/md.js

30 lines
1004 B
JavaScript
Raw Normal View History

2015-11-21 21:33:29 +03:00
import React from 'react';
import DocumentTitle from 'react-document-title';
import { link } from 'gatsby-helpers';
var DOCS_BASEURL = "https://github.com/graphql-python/graphene/edit/master/docs/pages/";
class Markdown extends React.Component {
render() {
var post = this.props.page.data;
var pagePath = this.props.page.requirePath;
var documentUrl = `${DOCS_BASEURL}${pagePath}`;
2015-11-26 02:25:03 +03:00
var showTitle = post.title && !this.props.docs;
2015-11-21 21:33:29 +03:00
return (
<DocumentTitle title={`${post.title?post.title+' - ':''}${this.props.config.siteTitle}`}>
2015-11-26 09:58:43 +03:00
<div>
2015-11-27 10:50:37 +03:00
{showTitle?<div className="page-title">
2015-11-21 21:33:29 +03:00
<h1>{post.title}</h1>
</div>:null}
2015-11-26 09:58:43 +03:00
<div className="markdown">
<div className={!this.props.docs?"wrapper":null} dangerouslySetInnerHTML={{__html: post.body}}/>
<a href={documentUrl} className="improve-document-link">Edit page</a>
</div>
2015-11-21 21:33:29 +03:00
</div>
</DocumentTitle>
);
}
}
module.exports = Markdown;