From d549eaaf9f52a1c7e9411fd22b6386e39c00111e Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Tue, 30 Dec 2025 15:55:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(HeroSection):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=B6=8B=E5=8A=BF=E6=8C=87=E7=A4=BA=E5=99=A8=E3=80=81=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=E3=80=81=E6=B0=B4=E5=8D=B0=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 TrendDirection、TrendInfo 类型支持环比/同比变化展示 - 添加 ProgressBarConfig 类型支持多空对比进度条 - 添加 WatermarkIconConfig 类型支持卡片水印背景图标 - HeroStatItem 扩展 trend、progressBar、watermark 可选属性 - index.tsx 导出新增类型 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/components/HeroSection/index.tsx | 6 ++++ src/components/HeroSection/types.ts | 49 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/components/HeroSection/index.tsx b/src/components/HeroSection/index.tsx index d313b59c..ece3163b 100644 --- a/src/components/HeroSection/index.tsx +++ b/src/components/HeroSection/index.tsx @@ -36,4 +36,10 @@ export type { HeroStatsProps, StatCardProps, SearchDropdownProps, + // 新增趋势和进度条类型 + TrendDirection, + TrendInfo, + ProgressBarConfig, + // 水印图标类型 + WatermarkIconConfig, } from './types'; diff --git a/src/components/HeroSection/types.ts b/src/components/HeroSection/types.ts index be5b45dd..61f04c1f 100644 --- a/src/components/HeroSection/types.ts +++ b/src/components/HeroSection/types.ts @@ -100,6 +100,49 @@ export interface HeroSearchConfig // ==================== 统计配置 ==================== +/** 趋势变化类型 */ +export type TrendDirection = 'up' | 'down' | 'flat'; + +/** 趋势信息配置 */ +export interface TrendInfo { + /** 变化方向 */ + direction: TrendDirection; + /** 变化百分比 */ + percent: number; + /** 自定义描述文字(如:放量、缩量) */ + label?: string; + /** 对比时间描述(如:较昨日、同比) */ + compareText?: string; +} + +/** 进度条配置(用于涨跌家数等多空对比场景) */ +export interface ProgressBarConfig { + /** 当前值 */ + value: number; + /** 总值(或对比的另一个值) */ + total: number; + /** 正向颜色(默认红色) */ + positiveColor?: string; + /** 负向颜色(默认绿色) */ + negativeColor?: string; + /** 对比项的标签 */ + compareLabel?: string; + /** 对比项的值 */ + compareValue?: number; +} + +/** 水印图标配置 */ +export interface WatermarkIconConfig { + /** 图标组件 */ + icon: LucideIcon | ComponentType<{ size?: number; color?: string }>; + /** 图标颜色 */ + color?: string; + /** 透明度(默认 0.08) */ + opacity?: number; + /** 图标大小(默认 48) */ + size?: number; +} + /** 统计项配置 */ export interface HeroStatItem { key: string; @@ -111,6 +154,12 @@ export interface HeroStatItem { suffix?: string; helpText?: string; isLoading?: boolean; + /** 趋势信息(显示环比/同比变化) */ + trend?: TrendInfo; + /** 进度条配置(显示多空对比) */ + progressBar?: ProgressBarConfig; + /** 水印背景图标配置 */ + watermark?: WatermarkIconConfig; } /** 统计区域配置 */