Files
datahub/packages/portaljs-components/src/components/blog/PostList.js
Luccas Mateus de Medeiros Gomes b2438e655f [monorepo][m] - restructuring
- renamed apps to examples
- renamed libs to packages
- fixed data-literate build
2023-04-11 13:23:53 -03:00

39 lines
837 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import parse from 'html-react-parser';
/**
* Displays a list of blog posts with the title and a short excerp from the content.
* @param {object} props
* {
* posts: {
* title: <The title of the blog post>
* excerpt: <A short excerpt from the post content>
* }
* }
* @returns
*/
const PostList = ({ posts }) => {
return (
<>
{posts.map((post, index) => (
<div key={index}>
<a
href={`/blog/${post.slug}`}
className="text-2xl font-semibold text-primary my-6 inline-block"
>
{parse(post.title)}
</a>
<p>{parse(post.excerpt)}</p>
</div>
))}
</>
);
};
PostList.propTypes = {
posts: PropTypes.object.isRequired
}
export default PostList;