From 1337071bec2a1c1f97652d23699b15f5a4f14c65 Mon Sep 17 00:00:00 2001 From: Aaron Sun Date: Wed, 30 Oct 2019 15:07:19 -0400 Subject: [PATCH] UI can now display all features of a post --- twistter-frontend/src/pages/user.js | 12 +++++++- twistter-frontend/src/util/PostSkeleton.js | 36 ++++++++++------------ 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/twistter-frontend/src/pages/user.js b/twistter-frontend/src/pages/user.js index af0243c..b9e7247 100644 --- a/twistter-frontend/src/pages/user.js +++ b/twistter-frontend/src/pages/user.js @@ -17,6 +17,7 @@ import TextField from '@material-ui/core/TextField'; import Userline from '../Userline'; import noImage from '../images/no-img.png'; import Writing_Microblogs from '../Writing_Microblogs'; +import PostSkeleton from '../util/PostSkeleton'; const MyChip = styled(Chip)({ margin: 2, @@ -107,7 +108,16 @@ class user extends Component { ) : (); let postMarkup = this.state.posts ? ( - this.state.posts.map(post =>

{post.body}

) + this.state.posts.map(post => +

+ {imageMarkup}
+ {post.userHandle}
+ {post.createdAt}
+ {post.microBlogTitle}
+ {post.body}
+ {post.microBlogTopics}
+ Likes {post.likeCount} Comments {post.commentCount}
+

) ) : (

My Posts

); return ( diff --git a/twistter-frontend/src/util/PostSkeleton.js b/twistter-frontend/src/util/PostSkeleton.js index ff14e16..25cbac5 100644 --- a/twistter-frontend/src/util/PostSkeleton.js +++ b/twistter-frontend/src/util/PostSkeleton.js @@ -1,12 +1,12 @@ /* eslint-disable */ -import React, { Fragment } from 'react'; +import React, { Component } from 'react'; import NoImg from '../images/no-img.png'; import PropTypes from 'prop-types'; // MUI import Card from '@material-ui/core/Card'; import CardMedia from '@material-ui/core/CardMedia'; import CardContent from '@material-ui/core/CardContent'; - +import Typography from '@material-ui/core/Typography'; import withStyles from '@material-ui/core/styles/withStyles'; const styles = (theme) => ({ @@ -50,23 +50,20 @@ const styles = (theme) => ({ } }); -const PostSkeleton = (props) => { - const { classes } = props; - - const content = Array.from({ length: 5 }).map((item, index) => ( - - - -
-
-
-
-
- - - )); - - return {content}; +class PostSkeleton extends Component { + render() { + const { classes, post: { body, createdAt, userImage, userHandle, screamId, likeCount, commentCount } } = this.props; + return ( + + + + {userHandle} + {createdAt} + {body} + + + ); + }; }; PostSkeleton.propTypes = { @@ -74,4 +71,3 @@ PostSkeleton.propTypes = { }; export default withStyles(styles)(PostSkeleton); -