acupedia-mobile-ui/src/features/profile/components/ProfileStatCard.tsx

94 lines
1.7 KiB
TypeScript

import React from "react";
import {
Pressable,
StyleSheet,
Text,
View,
} from "react-native";
import { Ionicons } from "@expo/vector-icons";
import {
moderateScale,
scale,
verticalScale,
} from "react-native-size-matters";
interface ProfileStatCardProps {
title: string;
value: string | number;
icon: keyof typeof Ionicons.glyphMap;
onPress?: () => void;
}
export default function ProfileStatCard({
title,
value,
icon,
onPress,
}: ProfileStatCardProps) {
return (
<Pressable
style={({ pressed }) => [
styles.card,
pressed && styles.pressed,
]}
onPress={onPress}
>
<View style={styles.iconContainer}>
<Ionicons
name={icon}
size={moderateScale(22)}
color="#5B3DF5"
/>
</View>
<Text style={styles.value}>
{value}
</Text>
<Text style={styles.title}>
{title}
</Text>
</Pressable>
);
}
const styles = StyleSheet.create({
card: {
width: "48%",
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
paddingVertical: verticalScale(18),
paddingHorizontal: scale(16),
marginBottom: verticalScale(14),
elevation: 2,
shadowColor: "#000",
shadowOpacity: 0.05,
shadowRadius: 6,
shadowOffset: {
width: 0,
height: 2,
},
alignItems: "center",
},
iconContainer: {
marginBottom: verticalScale(12),
},
value: {
fontSize: moderateScale(22),
fontWeight: "700",
color: "#1F2937",
},
title: {
marginTop: verticalScale(6),
textAlign: "center",
fontSize: moderateScale(13),
color: "#6B7280",
},
pressed: {
opacity: 0.85,
},
});