diff --git a/twistter-frontend/src/pages/user.js b/twistter-frontend/src/pages/user.js
index b9e7247..75f1703 100644
--- a/twistter-frontend/src/pages/user.js
+++ b/twistter-frontend/src/pages/user.js
@@ -7,6 +7,8 @@ import { Link } from 'react-router-dom';
import { makeStyles, styled } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
+import CardMedia from '@material-ui/core/CardMedia';
+import CardContent from '@material-ui/core/CardContent';
import Chip from '@material-ui/core/Chip';
import Button from '@material-ui/core/Button';
import Typography from "@material-ui/core/Typography";
@@ -17,7 +19,6 @@ 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,
@@ -99,25 +100,31 @@ class user extends Component {
onDelete={ (topic) => this.handleDelete(topic)}/>)
) : (
loading topics...
);
- let imageMarkup = this.state.imageUrl ? (
-
- ) : (
);
+ let imageMarkup = this.state.imageUrl ? (
) :
+ (
);
let postMarkup = this.state.posts ? (
this.state.posts.map(post =>
-
- {imageMarkup}
- {post.userHandle}
- {post.createdAt}
- {post.microBlogTitle}
- {post.body}
- {post.microBlogTopics}
- Likes {post.likeCount} Comments {post.commentCount}
-
)
+
+
+
+ {
+ this.state.imageUrl ? (
) :
+ (
)
+ }
+
+ {post.userHandle}
+ {post.createdAt}
+
+ {post.microBlogTitle}
+ {post.body}
+
+ Topics: {post.microBlogTopics}
+
+ Likes {post.likeCount} Comments {post.commentCount}
+
+
+ )
) : (My Posts
);
return (
@@ -133,7 +140,7 @@ class user extends Component {
margin="normal"
variant="outlined"
value={this.state.newTopic}
- onChange={ (event) => this.handleChange(event)}
+ onChange={(event) => this.handleChange(event)}
/>
Edit Profile Info
-
+ {postMarkup}
- {postMarkup}
+
);
diff --git a/twistter-frontend/src/util/PostSkeleton.js b/twistter-frontend/src/util/PostSkeleton.js
index 25cbac5..ff14e16 100644
--- a/twistter-frontend/src/util/PostSkeleton.js
+++ b/twistter-frontend/src/util/PostSkeleton.js
@@ -1,12 +1,12 @@
/* eslint-disable */
-import React, { Component } from 'react';
+import React, { Fragment } 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,20 +50,23 @@ const styles = (theme) => ({
}
});
-class PostSkeleton extends Component {
- render() {
- const { classes, post: { body, createdAt, userImage, userHandle, screamId, likeCount, commentCount } } = this.props;
- return (
-
-
-
- {userHandle}
- {createdAt}
- {body}
-
-
- );
- };
+const PostSkeleton = (props) => {
+ const { classes } = props;
+
+ const content = Array.from({ length: 5 }).map((item, index) => (
+
+
+
+
+
+
+
+
+
+
+ ));
+
+ return {content};
};
PostSkeleton.propTypes = {
@@ -71,3 +74,4 @@ PostSkeleton.propTypes = {
};
export default withStyles(styles)(PostSkeleton);
+