docusaurus/lib/core/Doc.js

55 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-07-07 13:28:29 -04:00
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
2017-07-07 13:28:29 -04:00
*/
2017-07-10 19:38:35 -04:00
const React = require("react");
const Marked = require("./Marked.js");
2017-07-07 13:28:29 -04:00
2017-08-15 19:55:38 -04:00
// inner doc component for article itself
2017-07-07 13:28:29 -04:00
class Doc extends React.Component {
render() {
let editLink =
2017-08-08 16:51:24 -04:00
!this.props.version &&
this.props.config.editUrl &&
2017-07-07 13:28:29 -04:00
<a
className="edit-page-link button"
2017-08-08 16:51:24 -04:00
href={this.props.config.editUrl + this.props.source}
2017-07-07 13:28:29 -04:00
target="_blank"
>
Edit this Doc
</a>;
if (this.props.language != "en") {
editLink =
2017-08-08 16:51:24 -04:00
!this.props.version &&
this.props.config.recruitingLink &&
<a
className="edit-page-link button"
href={this.props.config.recruitingLink + "/" + this.props.language}
target="_blank"
>
Translate this Doc
</a>;
}
2017-07-07 13:28:29 -04:00
return (
<div className="post">
<header className="postHeader">
{editLink}
2017-07-10 19:38:35 -04:00
<h1>
{this.props.title}
</h1>
2017-07-07 13:28:29 -04:00
</header>
<article>
2017-07-10 19:38:35 -04:00
<Marked>
{this.props.content}
</Marked>
2017-07-07 13:28:29 -04:00
</article>
</div>
);
}
}
module.exports = Doc;