// src/views/Community/components/EventCard/EventImportanceBadge.js import React from 'react'; import { Badge, Tooltip, VStack, HStack, Text, Divider, Circle } from '@chakra-ui/react'; import { InfoIcon } from '@chakra-ui/icons'; import { getImportanceConfig, getAllImportanceLevels } from '../../../../constants/importanceLevels'; /** * 事件重要性等级标签组件 * @param {Object} props * @param {string} props.importance - 重要性等级(S/A/B/C/D) * @param {boolean} props.showTooltip - 是否显示详细提示框(默认 false) * @param {boolean} props.showIcon - 是否显示信息图标(默认 false) * @param {string} props.size - 标签大小(xs/sm/md/lg,默认 xs) */ const EventImportanceBadge = ({ importance, showTooltip = false, showIcon = false, size = 'xs' }) => { const importanceConfig = getImportanceConfig(importance); // 简单模式:只显示标签 if (!showTooltip) { return ( {importance || 'C'}级 ); } // 详细模式:带提示框的标签 return ( 重要性等级说明 {getAllImportanceLevels().map((level) => ( {level.level}级 {level.description} ))} } placement="top" hasArrow bg="white" color="gray.800" fontSize="md" p={3} borderRadius="lg" borderWidth="1px" borderColor="gray.200" boxShadow="lg" > {showIcon && } {importance || 'C'}级 ); }; export default EventImportanceBadge;