From 7d859e18ca454e0316ed186642e3fd97847eee68 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Tue, 23 Dec 2025 14:57:12 +0800 Subject: [PATCH] =?UTF-8?q?style(HotSectorsRanking):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=B8=8E=E5=85=B3=E6=B3=A8=E8=82=A1=E7=A5=A8=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=20UI=20=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除外层装饰盒子(背景、边框、毛玻璃效果) - 标题行添加 TrendingUp 图标 + 数量显示 - 列表项添加 hover 效果和 cursor: pointer - 滚动条样式与 WatchlistPanel 一致 - 涨跌幅统一为 2 位小数 - 新增 onSectorClick 回调支持板块点击 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/atoms/HotSectorsRanking.js | 147 +++++++++++------- 1 file changed, 92 insertions(+), 55 deletions(-) diff --git a/src/views/Profile/components/MarketDashboard/components/atoms/HotSectorsRanking.js b/src/views/Profile/components/MarketDashboard/components/atoms/HotSectorsRanking.js index d15c44db..2b78f7b0 100644 --- a/src/views/Profile/components/MarketDashboard/components/atoms/HotSectorsRanking.js +++ b/src/views/Profile/components/MarketDashboard/components/atoms/HotSectorsRanking.js @@ -1,76 +1,113 @@ -// 热门板块排行组件 +// 热门板块排行组件 - 紧凑版(与 WatchlistPanel 风格保持一致) import React from 'react'; -import { Box, Text, VStack, HStack } from '@chakra-ui/react'; +import { Box, Text, VStack, HStack, Icon } from '@chakra-ui/react'; +import { TrendingUp } from 'lucide-react'; import MiniTrendLine from './MiniTrendLine'; -const HotSectorsRanking = ({ sectors = [], title = '热门板块排行' }) => { +const HotSectorsRanking = ({ sectors = [], title = '热门板块', onSectorClick }) => { // 默认数据 const defaultSectors = [ { rank: 1, name: '人工智能', change: 3.2, trend: [100, 102, 101, 104, 103, 106] }, { rank: 2, name: '新能源车', change: 1.8, trend: [100, 99, 101, 102, 101, 103] }, { rank: 3, name: '生物医药', change: 1.3, trend: [100, 101, 100, 102, 101, 102] }, { rank: 4, name: '消费科技', change: 1.2, trend: [100, 100, 101, 100, 102, 102] }, - { rank: 5, name: '其他', change: 0.4, trend: [100, 100, 100, 101, 100, 101] }, + { rank: 5, name: '芯片半导体', change: 0.4, trend: [100, 100, 100, 101, 100, 101] }, ]; const data = sectors.length > 0 ? sectors : defaultSectors; return ( - - - - {title} - + + {/* 标题 - 与 WatchlistPanel 风格一致 */} + + + + + {title} + + + ({data.length}) + + + - {/* 排行列表 */} - - {data.map((sector, index) => ( - - {/* 排名 */} - - - {sector.rank} - - - {sector.name} - - + {/* 板块列表 - 固定高度可滚动 */} + + + {data.map((sector, index) => { + const isUp = sector.change >= 0; + const changeColor = isUp ? '#EF4444' : '#22C55E'; - {/* 趋势线 */} - - = 0 ? 'red' : 'green'} - width={40} - height={14} - /> - - - {/* 涨跌幅 */} - = 0 ? '#EF4444' : '#22C55E'} - fontWeight="medium" - w="50px" - textAlign="right" + return ( + onSectorClick?.(sector)} > - {sector.change >= 0 ? '+' : ''}{sector.change.toFixed(1)}% - - - ))} + {/* 排名 + 名称 */} + + + {sector.rank || index + 1} + + + {sector.name} + + + + {/* 趋势线 + 涨跌幅 */} + + + + + + {isUp ? '+' : ''}{sector.change.toFixed(2)}% + + + + ); + })} - + ); };