-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLatestReviews.tsx
39 lines (35 loc) · 1.43 KB
/
LatestReviews.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Link } from "react-router-dom";
import ReviewModel from "../../models/ReviewModel";
import { Review } from "../Utils/Review";
export const LatestReviews: React.FC<{
reviews: ReviewModel[], bookId: number | undefined, mobile: boolean
}> = (props) => {
return (
<div className={props.mobile ? 'mt-3' : 'row mt-5'}>
<div className={props.mobile ? '' : 'col-sm-2 col-md-2'}>
<h2>Latest Reviews: </h2>
</div>
<div className='col-sm-10 col-md-10'>
{props.reviews.length > 0 ?
<>
{props.reviews.slice(0, 3).map(eachReview => (
<Review review={eachReview} key={eachReview.id}></Review>
))}
<div className='m-3'>
<Link type='button' className='btn main-color btn-md text-white'
to={`/reviewlist/${props.bookId}`}>
Reach all reviews.
</Link>
</div>
</>
:
<div className='m-3'>
<p className='lead'>
Currently there are no reviews for this book
</p>
</div>
}
</div>
</div>
);
}