/**
* 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.
*/
const Marked = require("./Marked.js");
const React = require("react");
// inner blog component for the article itself, without sidebar/header/footer
class BlogPost extends React.Component {
renderContent() {
let content = this.props.content;
if (this.props.truncate) {
content = content.split("")[0];
return (
{content}
);
}
return (
{content}
);
}
renderAuthorPhoto() {
const post = this.props.post;
const className = "authorPhoto" + ((post.author && post.authorTitle)
? " authorPhoto-big"
: "");
if (post.authorFBID) {
return (
);
} else if (post.authorImage) {
return (
);
} else {
return null;
}
}
renderTitle() {
const post = this.props.post;
return (
);
}
renderPostHeader() {
const post = this.props.post;
const match = post.path.match(/([0-9]+)\/([0-9]+)\/([0-9]+)/);
// Because JavaScript sucks at date handling :(
const year = match[1];
const month = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
][parseInt(match[2], 10) - 1];
const day = parseInt(match[3], 10);
return (
);
}
render() {
return (
{this.renderPostHeader()}
{this.renderContent()}
);
}
}
module.exports = BlogPost;