-
Notifications
You must be signed in to change notification settings - Fork 1.6k
result1 #1583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Diana2369
wants to merge
2
commits into
mate-academy:master
Choose a base branch
from
Diana2369:develop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
result1 #1583
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,61 @@ | ||
import './App.scss'; | ||
/* eslint-disable max-len */ | ||
|
||
// import postsFromServer from './api/posts.json'; | ||
// import commentsFromServer from './api/comments.json'; | ||
// import usersFromServer from './api/users.json'; | ||
import React from 'react'; | ||
import './App.scss'; | ||
import { PostList } from './components/PostList/PostList'; | ||
|
||
const usersFromServer = [ | ||
{ id: 1, name: 'Leanne Graham', email: '[email protected]' }, | ||
{ id: 2, name: 'Patricia Lebsack', email: '[email protected]' }, | ||
]; | ||
|
||
const commentsFromServer = [ | ||
{ | ||
id: 1, | ||
postId: 2, | ||
name: 'pariatur omnis in', | ||
email: '[email protected]', | ||
body: 'dolorum voluptas laboriosam quisquam ab totam beatae et aut aliquid optio assumenda voluptas velit itaque quidem voluptatem tempore cupiditate in itaque sit molestiae minus dolores magni', | ||
}, | ||
{ | ||
id: 2, | ||
postId: 2, | ||
name: 'odio adipisci rerum aut animi', | ||
email: '[email protected]', | ||
body: 'quia molestiae reprehenderit quasi aspernatur aut expedita occaecati aliquam eveniet laudantium omnis quibusdam delectus saepe quia accusamus maiores nam est cum et ducimus et vero voluptates excepturi deleniti ratione', | ||
}, | ||
]; | ||
|
||
const postsFromServer = [ | ||
{ | ||
id: 1, | ||
title: 'qui est esse', | ||
body: 'est rerum tempore vitae sequi sint nihil reprehenderit dolor beatae ea dolores neque fugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis qui aperiam non debitis possimus qui neque nisi nulla', | ||
userId: 1, | ||
}, | ||
{ | ||
id: 2, | ||
title: 'doloremque illum aliquid sunt', | ||
body: 'deserunt eos nobis asperiores et hic est debitis repellat molestiae optio nihil ratione ut eos beatae quibusdam distinctio maiores earum voluptates et aut adipisci ea maiores voluptas maxime', | ||
userId: 2, | ||
}, | ||
]; | ||
|
||
const posts = postsFromServer.map(post => { | ||
const user = usersFromServer.find(u => u.id === post.userId); | ||
const comments = commentsFromServer.filter(c => c.postId === post.id); | ||
|
||
return { | ||
...post, | ||
user, | ||
comments, | ||
}; | ||
}); | ||
|
||
export const App = () => ( | ||
<section className="App"> | ||
<h1 className="App__title">Static list of posts</h1> | ||
|
||
<div className="PostList"> | ||
<div className="PostInfo"> | ||
<div className="PostInfo__header"> | ||
<h3 className="PostInfo__title">qui est esse</h3> | ||
|
||
<p> | ||
{' Posted by '} | ||
|
||
<a className="UserInfo" href="mailto:[email protected]"> | ||
Leanne Graham | ||
</a> | ||
</p> | ||
</div> | ||
|
||
<p className="PostInfo__body"> | ||
est rerum tempore vitae sequi sint nihil reprehenderit dolor beatae ea | ||
dolores neque fugiat blanditiis voluptate porro vel nihil molestiae ut | ||
reiciendis qui aperiam non debitis possimus qui neque nisi nulla | ||
</p> | ||
|
||
<hr /> | ||
|
||
<b data-cy="NoCommentsMessage">No comments yet</b> | ||
</div> | ||
|
||
<div className="PostInfo"> | ||
<div className="PostInfo__header"> | ||
<h3 className="PostInfo__title">doloremque illum aliquid sunt</h3> | ||
|
||
<p> | ||
{' Posted by '} | ||
|
||
<a className="UserInfo" href="mailto:[email protected]"> | ||
Patricia Lebsack | ||
</a> | ||
</p> | ||
</div> | ||
|
||
<p className="PostInfo__body"> | ||
deserunt eos nobis asperiores et hic est debitis repellat molestiae | ||
optio nihil ratione ut eos beatae quibusdam distinctio maiores earum | ||
voluptates et aut adipisci ea maiores voluptas maxime | ||
</p> | ||
|
||
<div className="CommentList"> | ||
<div className="CommentInfo"> | ||
<div className="CommentInfo__title"> | ||
<strong className="CommentInfo__name">pariatur omnis in</strong> | ||
|
||
{' by '} | ||
|
||
<a | ||
className="CommentInfo__email" | ||
href="mailto:[email protected]" | ||
> | ||
[email protected] | ||
</a> | ||
</div> | ||
|
||
<div className="CommentInfo__body"> | ||
dolorum voluptas laboriosam quisquam ab totam beatae et aut | ||
aliquid optio assumenda voluptas velit itaque quidem voluptatem | ||
tempore cupiditate in itaque sit molestiae minus dolores magni | ||
</div> | ||
</div> | ||
|
||
<div className="CommentInfo"> | ||
<div className="CommentInfo__title"> | ||
<strong className="CommentInfo__name"> | ||
odio adipisci rerum aut animi | ||
</strong> | ||
|
||
{' by '} | ||
|
||
<a | ||
className="CommentInfo__email" | ||
href="mailto:[email protected]" | ||
> | ||
[email protected] | ||
</a> | ||
</div> | ||
|
||
<div className="CommentInfo__body"> | ||
quia molestiae reprehenderit quasi aspernatur aut expedita | ||
occaecati aliquam eveniet laudantium omnis quibusdam delectus | ||
saepe quia accusamus maiores nam est cum et ducimus et vero | ||
voluptates excepturi deleniti ratione | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<PostList posts={posts} /> | ||
</section> | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
export const CommentInfo = () => <>Put the comment here</>; | ||
import React from 'react'; | ||
import './CommentInfo.scss'; | ||
|
||
export const CommentInfo = ({ comment }) => ( | ||
<div className="CommentInfo"> | ||
<div className="CommentInfo__title"> | ||
<strong className="CommentInfo__name">{comment.name}</strong> | ||
{' by '} | ||
<a className="CommentInfo__email" href={`mailto:${comment.email}`}> | ||
{comment.email} | ||
</a> | ||
</div> | ||
|
||
<div className="CommentInfo__body">{comment.body}</div> | ||
</div> | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
// add styles here | ||
.CommentInfo { | ||
&__title { | ||
margin-bottom: 0.5em; | ||
} | ||
|
||
&__name { | ||
font-weight: bold; | ||
} | ||
|
||
&__email { | ||
color: blue; | ||
text-decoration: underline; | ||
} | ||
|
||
&__body { | ||
line-height: 1.4; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
export const CommentList = () => <>Put the list here</>; | ||
import React from 'react'; | ||
import { CommentInfo } from '../CommentInfo/CommentInfo'; | ||
import './CommentList.scss'; | ||
|
||
export const CommentList = ({ comments }) => { | ||
if (!comments.length) { | ||
return <b data-cy="NoCommentsMessage">No comments yet</b>; | ||
} | ||
|
||
return ( | ||
<div className="CommentList"> | ||
{comments.map(comment => ( | ||
<CommentInfo key={comment.id} comment={comment} /> | ||
))} | ||
</div> | ||
); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
// add styles here | ||
.CommentList { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.7em; | ||
background-color: #eee; | ||
padding: 1em; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
export const PostInfo = () => <>Put the post here</>; | ||
import React from 'react'; | ||
import { UserInfo } from '../UserInfo/UserInfo'; | ||
import { CommentList } from '../CommentList/CommentList'; | ||
import './PostInfo.scss'; | ||
|
||
export const PostInfo = ({ post }) => ( | ||
<div className="PostInfo"> | ||
<div className="PostInfo__header"> | ||
<h3 className="PostInfo__title">{post.title}</h3> | ||
|
||
<p> | ||
{' Posted by '} | ||
<UserInfo user={post.user} /> | ||
</p> | ||
</div> | ||
|
||
<p className="PostInfo__body">{post.body}</p> | ||
|
||
<hr /> | ||
|
||
{post.comments.length > 0 ? ( | ||
<CommentList comments={post.comments} /> | ||
) : ( | ||
<b data-cy="NoCommentsMessage">No comments yet</b> | ||
)} | ||
</div> | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
// add styles here | ||
.PostInfo { | ||
margin: 10px auto; | ||
width: 90%; | ||
border: 1px solid #000; | ||
border-radius: 8px; | ||
background-color: lightgray; | ||
padding: 1em; | ||
|
||
&__title { | ||
margin: 0; | ||
} | ||
|
||
&__header { | ||
margin-bottom: 1em; | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
export const PostList = () => <>Put the list here</>; | ||
import React from 'react'; | ||
import { PostInfo } from '../PostInfo/PostInfo'; | ||
import './PostList.scss'; | ||
|
||
export const PostList = ({ posts }) => ( | ||
<div className="PostList"> | ||
{posts.map(post => ( | ||
<PostInfo key={post.id} post={post} /> | ||
))} | ||
</div> | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
export const UserInfo = () => <>Put the user here</>; | ||
import React from 'react'; | ||
import './UserInfo.scss'; | ||
|
||
export const UserInfo = ({ user }) => ( | ||
<a className="UserInfo" href={`mailto:${user.email}`}> | ||
{user.name} | ||
</a> | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
// add styles here | ||
.UserInfo { | ||
font-weight: bold; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: The 'No comments yet' message is conditionally rendered here, but according to the checklist, this message should only be shown in the CommentList component. Please remove this conditional and always render . Checklist reference: 'The message "No comments yet" should only be shown in the CommentList component, not in PostInfo.'