事件中心UI优化

This commit is contained in:
2025-11-07 10:56:08 +08:00
parent 2a122b0013
commit 3eff0554f9
7 changed files with 219 additions and 77 deletions

View File

@@ -4,6 +4,7 @@
import React from 'react';
import { Flex, Box, Text, useColorModeValue } from '@chakra-ui/react';
import { TriangleUpIcon, TriangleDownIcon } from '@chakra-ui/icons';
import { getChangeColor } from '../utils/colorUtils';
/**
* 股票涨跌幅指标组件3分天下布局
@@ -23,19 +24,14 @@ const StockChangeIndicators = ({
const isComfortable = size === 'comfortable';
const isDefault = size === 'default';
// 根据涨跌幅获取数字颜色(统一颜色,不分级
// 根据涨跌幅获取数字颜色(动态深浅
const getNumberColor = (value) => {
if (value == null) {
return useColorModeValue('gray.700', 'gray.400');
}
// 0值使用中性灰色
if (value === 0) {
return 'gray.700';
}
// 统一颜色:上涨红色,下跌绿色
return value > 0 ? 'red.500' : 'green.500';
// 使用动态颜色函数
return getChangeColor(value);
};
// 根据涨跌幅获取背景色(永远比文字色浅)