All files / app/detail/components SafetyAnalysisSection.tsx

100% Statements 3/3
100% Branches 2/2
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74                        2x   1x                                                                                                                      
/**
 * 安全性分析卡片 - 显示猫粮安全性评估结果
 */
import { Text, XStack, YStack } from 'tamagui';
import { IconSymbol } from '@/src/components/ui/IconSymbol';
import { successScale, neutralScale } from '@/src/design-system/tokens';
 
interface SafetyAnalysisSectionProps {
  safety: string;
}
 
export function SafetyAnalysisSection({ safety }: SafetyAnalysisSectionProps) {
  if (!safety) return null;
 
  return (
    <YStack
      marginHorizontal="$3"
      marginBottom="$3"
      borderRadius={20}
      backgroundColor="white"
      overflow="hidden"
      borderWidth={1}
      borderColor={neutralScale.neutral3}
    >
      {/* 标题栏 */}
      <XStack
        padding="$4"
        alignItems="center"
        gap="$3"
        borderBottomWidth={1}
        borderBottomColor={neutralScale.neutral2}
      >
        <YStack
          width={44}
          height={44}
          borderRadius={22}
          backgroundColor={successScale.success2}
          alignItems="center"
          justifyContent="center"
        >
          <IconSymbol name="checkmark.shield.fill" size={22} color={successScale.success7} />
        </YStack>
        <YStack flex={1}>
          <Text fontSize="$5" fontWeight="700" color={neutralScale.neutral12}>
            安全性分析
          </Text>
          <Text fontSize={11} color={neutralScale.neutral8} marginTop={2}>
            Safety Analysis
          </Text>
        </YStack>
        <YStack
          backgroundColor={successScale.success2}
          paddingHorizontal="$2.5"
          paddingVertical="$1.5"
          borderRadius={12}
        >
          <Text fontSize={11} fontWeight="700" color={successScale.success8}>
            安全
          </Text>
        </YStack>
      </XStack>
 
      {/* 内容区域 */}
      <YStack padding="$4">
        <YStack padding="$4" backgroundColor={successScale.success1} borderRadius={12}>
          <Text fontSize="$3" lineHeight={24} color={neutralScale.neutral11} fontWeight="500">
            {safety}
          </Text>
        </YStack>
      </YStack>
    </YStack>
  );
}