Skip to content
Snippets Groups Projects
Commit 69db7154 authored by Martin Wighus Holtmon's avatar Martin Wighus Holtmon
Browse files

projectPart2/Problem2: Styled it a bit better

parent c4ea6054
No related branches found
No related tags found
No related merge requests found
...@@ -9,25 +9,54 @@ ...@@ -9,25 +9,54 @@
#divImageList > .divImageItem { #divImageList > .divImageItem {
width: 49%; width: 49%;
min-width: 450px;
height: auto; height: auto;
display: flex; display: inline-flex;
flex-flow: column nowrap; flex-flow: column nowrap;
justify-content: flex-start; background-color: #FAFAFA;
/*background-color: blue; */ border: solid #DBDBDB;
} }
#divImageList > .divImageItem > .divImage { #divImageList > .divImageItem > .divImage {
max-height: 300px; max-height: 300px;
text-align: left;
} }
#divImageList > .divImageItem > .divImage img { #divImageList > .divImageItem > .divImage img {
display: block; display: block;
margin: auto;
max-height: 100%; max-height: 100%;
max-width: 100%; max-width: 100%;
height: auto; height: auto;
width: auto; width: auto;
} }
#divImageList > .divImageItem > .divImage span {
position: center;
}
#divImageList > .divImageItem > .divPhotoInfo { #divImageList > .divImageItem > .divPhotoInfo {
margin-top: 5px; margin: 5px;
}
.text-link {
color: inherit;
text-decoration: inherit;
font-weight: bold;
}
.text-link:hover {
text-decoration: underline;
}
.comment {
margin-bottom: 8px;
} }
.comment-date {
color: #8E8E8E;
font-weight: lighter;
text-transform: uppercase;
font-size: smaller;
}
...@@ -34,7 +34,7 @@ class UserPhotos extends React.Component { ...@@ -34,7 +34,7 @@ class UserPhotos extends React.Component {
getAuthor = (user) => { getAuthor = (user) => {
if (user) { if (user) {
return <Link to={`/photo-share/users/${user._id}`}>{user.first_name} {user.last_name}</Link>; return <Link className="text-link" to={`/photo-share/users/${user._id}`}>{user.first_name} {user.last_name}</Link>;
} }
return ''; return '';
}; };
...@@ -46,16 +46,16 @@ class UserPhotos extends React.Component { ...@@ -46,16 +46,16 @@ class UserPhotos extends React.Component {
<> <>
{image.comments.map((comment) => { {image.comments.map((comment) => {
return ( return (
<div key={comment._id}> <div className="comment" key={comment._id}>
{comment.comment} <br/> {this.getAuthor(comment.user)} {comment.comment} <br/>
Created on {comment.date_time} by {this.getAuthor(comment.user)}<br/><br/> <span className="comment-date">Commented {comment.date_time}</span>
</div> </div>
); );
})} })}
</> </>
); );
} }
return <>No Comments!</>; return <></>;
}; };
render() { render() {
...@@ -68,9 +68,8 @@ class UserPhotos extends React.Component { ...@@ -68,9 +68,8 @@ class UserPhotos extends React.Component {
<img src={path.join(__dirname, 'images', image.file_name)}/> <img src={path.join(__dirname, 'images', image.file_name)}/>
</div> </div>
<div className="divPhotoInfo"> <div className="divPhotoInfo">
<span>Creation date: {image.date_time}</span> <br/>
<span>Comments: </span><br/>
{this.generateComments(image)} {this.generateComments(image)}
<span>Created {image.date_time}</span>
</div> </div>
</div> </div>
))} ))}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment