-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Mayanzev/module5-task2
- Loading branch information
Showing
15 changed files
with
131 additions
and
175 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Review } from '../../types/review'; | ||
|
||
type ReviewProps = { | ||
review: Review; | ||
} | ||
|
||
function ReviewItem({review}: ReviewProps): JSX.Element { | ||
return ( | ||
<li className="reviews__item"> | ||
<div className="reviews__user user"> | ||
<div className="reviews__avatar-wrapper user__avatar-wrapper"> | ||
<img className="reviews__avatar user__avatar" src={review.avatar} width="54" height="54" alt="Reviews avatar"/> | ||
</div> | ||
<span className="reviews__user-name"> | ||
{review.author} | ||
</span> | ||
</div> | ||
<div className="reviews__info"> | ||
<div className="reviews__rating rating"> | ||
<div className="reviews__stars rating__stars"> | ||
<span style={{width: `${(review.rating / 5) * 100}%`}}></span> | ||
<span className="visually-hidden">Rating</span> | ||
</div> | ||
</div> | ||
<p className="reviews__text"> | ||
{review.comment} | ||
</p> | ||
<time className="reviews__time" dateTime="2019-04-24">{review.date}</time> | ||
</div> | ||
</li> | ||
); | ||
} | ||
export default ReviewItem; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Review } from '../../types/review'; | ||
import ReviewItem from '../reviews-item/reviews-item'; | ||
import CommentForm from '../../components/comment-form/comment-form'; | ||
|
||
type ReviewsListProps = { | ||
reviews: Review[]; | ||
}; | ||
|
||
function ReviewsList({ reviews }: ReviewsListProps): JSX.Element { | ||
return ( | ||
<section className="offer__reviews reviews"> | ||
<h2 className="reviews__title">Reviews · <span className="reviews__amount">{reviews.length}</span></h2> | ||
<ul className="reviews__list"> | ||
{reviews.map((review) => ( | ||
<ReviewItem key={review.id} review={review} /> | ||
))} | ||
</ul> | ||
<CommentForm /> | ||
</section> | ||
); | ||
} | ||
|
||
export default ReviewsList; |
This file contains 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 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 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 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 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 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 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
Oops, something went wrong.