docusaurus/lib/core/Doc.js

59 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-07-07 13:28:29 -04:00
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
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
class Doc extends React.Component {
render() {
let editLink =
this.props.config.editUrl &&
2017-07-07 13:28:29 -04:00
<a
className="edit-page-link button"
href={
this.props.config.editUrl +
2017-07-10 19:38:35 -04:00
this.props.language +
"/" +
this.props.source
2017-07-07 13:28:29 -04:00
}
target="_blank"
>
Edit this Doc
</a>;
if (this.props.language != "en") {
editLink =
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;