/** * 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'; function BlogPostItem(props) { const {children, frontMatter, metadata, truncated} = props; const {date, permalink, tags} = metadata; const {author, authorURL, authorTitle, authorFBID, title} = frontMatter; const renderPostHeader = () => { const match = date.substring(0, 10).split('-'); const year = match[0]; const month = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', ][parseInt(match[1], 10) - 1]; const day = parseInt(match[2], 10); const authorImageURL = authorFBID ? `https://graph.facebook.com/${authorFBID}/picture/?height=200&width=200` : frontMatter.authorImageURL; return (

{title}

{month} {day}, {year}
{authorImageURL && ( {author} )}
{author && ( <>

{author}

{authorTitle} )}
); }; return (
{renderPostHeader()}
{children}
{tags.length > 0 && ( <> Tags: {tags.map(({label, permalink: tagPermalink}) => ( {label} ))} )}
{truncated && ( Read More )}
); } export default BlogPostItem;