/** * 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. */ import React from 'react'; import Link from '@docusaurus/Link'; import classnames from 'classnames'; // eslint-disable-line import styles from './styles.module.css'; function Post(props) { const {metadata, children, truncated} = props; const renderPostHeader = () => { if (!metadata) { return null; } const { date, author, authorURL, authorTitle, authorFBID, permalink, title, } = metadata; const blogPostDate = new Date(date); const month = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', ]; const authorImageURL = authorFBID ? `https://graph.facebook.com/${authorFBID}/picture/?height=200&width=200` : metadata.authorImageURL; return (

{title}

{month[blogPostDate.getMonth()]} {blogPostDate.getDay()},{' '} {blogPostDate.getFullYear()}

{author ? (

{author} {authorTitle}

) : null} {authorImageURL && (
{author}
)}{' '}
); }; return (
{renderPostHeader()} {children} {truncated && (
Read More
)}
); } export default Post;