bento-feature.tsx 1009 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { Ionicons } from '@expo/vector-icons';
  2. import React from 'react';
  3. import { Text, View } from 'react-native';
  4. interface BentoFeatureProps {
  5. icon: keyof typeof Ionicons.glyphMap;
  6. iconBgClass?: string;
  7. iconColor?: string;
  8. label: string;
  9. value: string;
  10. }
  11. /**
  12. * Bento 特性卡片 — 小卡片展示关键指标
  13. * surface-container-lowest 底色,xl 圆角
  14. */
  15. export function BentoFeature({
  16. icon,
  17. iconBgClass = 'bg-blue-50',
  18. iconColor = '#2563eb',
  19. label,
  20. value,
  21. }: BentoFeatureProps) {
  22. return (
  23. <View className="flex-1 bg-surface-container-lowest p-5 rounded-2xl justify-between h-36 shadow-sm">
  24. <View className={`w-10 h-10 rounded-xl items-center justify-center ${iconBgClass}`}>
  25. <Ionicons name={icon} size={22} color={iconColor} />
  26. </View>
  27. <View className="mt-2">
  28. <Text className="text-xs text-on-surface-variant">{label}</Text>
  29. <Text className="font-bold text-lg text-on-surface">{value}</Text>
  30. </View>
  31. </View>
  32. );
  33. }