[Components][l]: Update portal components

This commit is contained in:
Rising Odegua
2021-05-10 14:53:52 +01:00
parent 97f425c863
commit 12cfd0d54e
7 changed files with 277 additions and 73 deletions

View File

@@ -5,24 +5,24 @@ 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>
* modified: <The utc date when the post was last modified.
* featured_image: <Url/relative url to post cover image
* 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 = ({ page }) => {
const { title, content, modified, featured_image } = page;
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">Edited: {modified}</p>
<img src={featured_image} className="mb-6" alt="featured_img" />
<p className="mb-6">Posted: {createdAt}</p>
<img src={featuredImage} className="mb-6" alt="featured_img" />
<div>{parse(content)}</div>
</>
);
@@ -33,8 +33,8 @@ Post.propTypes = {
page: PropTypes.shape({
title: PropTypes.string.isRequired,
content: PropTypes.string.isRequired,
modified: PropTypes.string,
featured_image: PropTypes.string,
createdAt: PropTypes.number,
featuredImage: PropTypes.string,
})
}

View File

@@ -16,9 +16,6 @@ import parse from 'html-react-parser';
const PostList = ({ posts }) => {
return (
<>
<h1 className="text-3xl font-semibold text-primary my-6 inline-block">
{posts.length} posts found
</h1>
{posts.map((post, index) => (
<div key={index}>
<a