/** * HotConceptsPanel 工具函数 */ import { COLORS } from './styles'; /** * 格式化涨跌幅显示 * 复用自 src/views/Company/components/StockQuoteCard/components/formatters.ts */ export const formatChangePercent = (value: number | null | undefined): string => { if (value == null) return '--'; const sign = value >= 0 ? '+' : ''; return `${sign}${value.toFixed(2)}%`; }; /** * 获取涨跌颜色 * 简化版本,深色主题专用 */ export const getChangeColor = (value: number | null | undefined): string => { if (value == null) return COLORS.neutral; if (value > 0) return COLORS.up; if (value < 0) return COLORS.down; return COLORS.neutral; };