/** * StockHeader - 股票头部原子组件 * * 深空 FUI 设计风格: * - 股票名称带金色发光 * - 行业标签使用金色边框 * - 操作按钮悬停态有玻璃效果 */ import React, { memo } from 'react'; import { Flex, HStack, Text, Badge, IconButton, Tooltip } from '@chakra-ui/react'; import { Share2 } from 'lucide-react'; import FavoriteButton from '@components/FavoriteButton'; import CompareStockInput from './CompareStockInput'; import { DEEP_SPACE_THEME as T } from './theme'; export interface StockHeaderProps { /** 股票名称 */ name: string; /** 股票代码 */ code: string; /** 一级行业 */ industryL1?: string; /** 二级行业 */ industry?: string; /** 指数标签(沪深300、中证500等) */ indexTags?: string[]; /** 更新时间 */ updateTime?: string; // 关注相关 isInWatchlist?: boolean; isWatchlistLoading?: boolean; onWatchlistToggle?: () => void; // 分享 onShare?: () => void; // 对比相关 isCompareLoading?: boolean; onCompare?: (stockCode: string) => void; } /** * 股票头部组件 * * 包含: * - 左侧:股票名称、代码、行业标签、指数标签 * - 右侧:对比输入、关注按钮、分享按钮、更新时间 */ export const StockHeader: React.FC = memo(({ name, code, industryL1, industry, indexTags, updateTime, isInWatchlist = false, isWatchlistLoading = false, onWatchlistToggle, onShare, isCompareLoading = false, onCompare, }) => { return ( {/* 左侧:股票名称 + 行业标签 + 指数标签 */} {/* 股票名称 - 金色发光效果 */} {name} ({code}) {/* 行业标签 - 金色边框 */} {(industryL1 || industry) && ( {industryL1 && industry ? `${industryL1} · ${industry}` : industry || industryL1} )} {/* 指数标签 */} {indexTags && indexTags.length > 0 && ( {indexTags.join('、')} )} {/* 右侧:对比 + 关注 + 分享 + 时间 */} {/* 股票对比输入 */} {})} isLoading={isCompareLoading} currentStockCode={code} /> {})} colorScheme="gold" size="sm" /> } variant="ghost" color={T.textSecondary} size="sm" borderRadius={T.radiusSM} onClick={onShare} _hover={{ bg: T.borderGlass, color: T.textPrimary }} /> {updateTime?.split(' ')[1] || '--:--'} ); }); StockHeader.displayName = 'StockHeader';