Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 4ce7f57

Browse files
committed
update: recipient card component
1 parent 67c7889 commit 4ce7f57

File tree

1 file changed

+71
-69
lines changed

1 file changed

+71
-69
lines changed
Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,88 @@
11
import { useRouter } from 'expo-router';
22
import { Image, Pressable, StyleSheet, Text, View } from 'react-native';
3-
import { Recipient } from '@/models/Recipient';
3+
4+
import { Recipient } from '@/features/recipients/types';
45

56
export default function RecipientCard({
6-
id,
7-
image,
8-
name,
7+
id,
8+
image,
9+
name,
910
description,
10-
budget,
11-
spent,
11+
budget,
12+
spent,
1213
}: Recipient) {
13-
const router = useRouter();
14+
const router = useRouter();
1415

15-
const handlePress = () => {
16-
router.push({
17-
pathname: '/recipients/detail-recipient',
18-
params: { id, image, name, description, budget, spent },
19-
});
20-
};
16+
const handlePress = () => {
17+
router.push({
18+
pathname: '/recipients/detail-recipient',
19+
params: { id },
20+
});
21+
};
2122

22-
return (
23-
<Pressable style={styles.card} onPress={handlePress}>
24-
<Image source={{ uri: image }} style={styles.image} />
25-
<View style={styles.content}>
26-
<Text style={styles.name}>{name}</Text>
27-
<Text style={styles.budget}>Budget: ${budget}</Text>
28-
<Text style={styles.spent}>Spent: ${spent}</Text>
29-
</View>
30-
</Pressable>
31-
);
23+
return (
24+
<Pressable style={styles.card} onPress={handlePress}>
25+
<Image source={{ uri: image }} style={styles.image} />
26+
<View style={styles.content}>
27+
<Text style={styles.name}>{name}</Text>
28+
{description && <Text style={styles.description}>{description}</Text>}
29+
<Text style={styles.budget}>Budget: ${budget}</Text>
30+
<Text style={styles.spent}>Spent: ${spent}</Text>
31+
</View>
32+
</Pressable>
33+
);
3234
}
3335

3436
const styles = StyleSheet.create({
35-
card: {
36-
backgroundColor: 'white',
37-
borderRadius: 12,
38-
marginHorizontal: 16,
39-
marginVertical: 8,
40-
flexDirection: 'row',
41-
padding: 12,
42-
shadowColor: '#000000',
43-
shadowOffset: { width: 0, height: 2 },
44-
shadowOpacity: 0.1,
45-
shadowRadius: 4,
46-
elevation: 2,
47-
alignItems: 'center',
48-
},
49-
image: {
50-
width: 60,
51-
height: 60,
52-
borderRadius: 30,
53-
},
54-
content: {
55-
marginLeft: 12,
56-
flex: 1,
57-
},
58-
name: {
59-
fontSize: 16,
60-
fontWeight: '600',
61-
color: '#333333',
62-
},
37+
card: {
38+
backgroundColor: 'white',
39+
borderRadius: 12,
40+
marginHorizontal: 16,
41+
marginVertical: 8,
42+
flexDirection: 'row',
43+
padding: 12,
44+
shadowColor: '#000000',
45+
shadowOffset: { width: 0, height: 2 },
46+
shadowOpacity: 0.1,
47+
shadowRadius: 4,
48+
elevation: 2,
49+
alignItems: 'center',
50+
},
51+
image: {
52+
width: 60,
53+
height: 60,
54+
borderRadius: 30,
55+
},
56+
content: {
57+
marginLeft: 12,
58+
flex: 1,
59+
},
60+
name: {
61+
fontSize: 16,
62+
fontWeight: '600',
63+
color: '#333333',
64+
},
6365
description: {
6466
fontSize: 14,
6567
color: '#666666',
6668
marginTop: 4,
6769
},
68-
budget: {
69-
fontSize: 14,
70-
color: '#666666',
71-
marginTop: 4,
72-
},
73-
spent: {
74-
fontSize: 14,
75-
color: '#666666',
76-
marginTop: 4,
77-
},
78-
actions: {
79-
flexDirection: 'column',
80-
alignItems: 'center',
81-
justifyContent: 'space-evenly',
82-
},
83-
actionButton: {
84-
marginVertical: 8,
85-
},
70+
budget: {
71+
fontSize: 14,
72+
color: '#666666',
73+
marginTop: 4,
74+
},
75+
spent: {
76+
fontSize: 14,
77+
color: '#666666',
78+
marginTop: 4,
79+
},
80+
actions: {
81+
flexDirection: 'column',
82+
alignItems: 'center',
83+
justifyContent: 'space-evenly',
84+
},
85+
actionButton: {
86+
marginVertical: 8,
87+
},
8688
});

0 commit comments

Comments
 (0)