-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBookCard.js
More file actions
32 lines (28 loc) · 875 Bytes
/
BookCard.js
File metadata and controls
32 lines (28 loc) · 875 Bytes
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
import React, { useState } from 'react';
import { Text } from 'react-native';
import { Card, CardItem, Body } from 'native-base';
import { tw } from 'react-native-tailwindcss';
import Rating from './Rating';
const BookCard = ({ title, author, url }) => {
const [rating, setRating] = useState(0);
const handleRatingChange = (selectedRating) => {
setRating(selectedRating);
};
return (
<Card style={tw.mB4}>
<CardItem>
<Body>
<Text style={[tw.textLg, tw.fontBold]}>{title}</Text>
<Text note style={[tw.textGray600, tw.fontBold]}>
{author}
</Text>
<Text style={[tw.textGray700, tw.mT2]}>{url}</Text>
</Body>
</CardItem>
<CardItem>
<Rating initialRating={rating} onRatingChange={handleRatingChange} />
</CardItem>
</Card>
);
};
export default BookCard;