[#812,package][xl]: initial versioning of the package

This commit is contained in:
deme
2023-05-01 15:53:42 -03:00
parent cc43597130
commit 169a92d313
49 changed files with 11254 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import React from 'react';
import PropTypes from 'prop-types';
import parse from 'html-react-parser';
/**
* Displays a blog post page
* @param {object} props
* post = {
* title: <The title of the blog post>
* content: <The body of the blog post. Can be plain text or html>
* createdAt: <The utc date when the post was last modified>.
* featuredImage: <Url/relative url to post cover image>
* }
* @returns
*/
const Post = ({ post }) => {
const { title, content, createdAt, featuredImage } = post;
return (
<>
<h1 className="text-3xl font-semibold text-primary my-6 inline-block">
{title}
</h1>
<p className="mb-6">Posted: {createdAt}</p>
<img src={featuredImage} className="mb-6" alt="featured_img" />
<div>{parse(content)}</div>
</>
);
};
Post.propTypes = {
page: PropTypes.shape({
title: PropTypes.string.isRequired,
content: PropTypes.string.isRequired,
createdAt: PropTypes.number,
featuredImage: PropTypes.string,
})
}
export default Post;

View File

@@ -0,0 +1,38 @@
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;