feat(HeroSection): 新增趋势指示器、进度条、水印图标类型定义

- 添加 TrendDirection、TrendInfo 类型支持环比/同比变化展示
- 添加 ProgressBarConfig 类型支持多空对比进度条
- 添加 WatermarkIconConfig 类型支持卡片水印背景图标
- HeroStatItem 扩展 trend、progressBar、watermark 可选属性
- index.tsx 导出新增类型

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zdl
2025-12-30 15:55:01 +08:00
parent 1e511cb3f5
commit d549eaaf9f
2 changed files with 55 additions and 0 deletions

View File

@@ -36,4 +36,10 @@ export type {
HeroStatsProps,
StatCardProps,
SearchDropdownProps,
// 新增趋势和进度条类型
TrendDirection,
TrendInfo,
ProgressBarConfig,
// 水印图标类型
WatermarkIconConfig,
} from './types';

View File

@@ -100,6 +100,49 @@ export interface HeroSearchConfig<T extends SearchResultItem = SearchResultItem>
// ==================== 统计配置 ====================
/** 趋势变化类型 */
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;
}
/** 统计区域配置 */