feat: 添加Company 页面头部组件 CompanyHeader

index.js            # 组合导出
SearchBar.js        # 股票搜索栏
WatchlistButton.js  # 自选股按钮
This commit is contained in:
zdl
2025-12-09 14:59:24 +08:00
parent 44fcef5eae
commit ad26ae0a44
4 changed files with 354 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
// src/views/Company/components/CompanyHeader/WatchlistButton.js
// 自选股按钮组件
import React from 'react';
import { Button } from '@chakra-ui/react';
import { StarIcon } from '@chakra-ui/icons';
/**
* 自选股按钮组件
*
* @param {Object} props
* @param {boolean} props.isInWatchlist - 是否已在自选股中
* @param {boolean} props.isLoading - 是否正在加载
* @param {Function} props.onClick - 点击回调
*/
const WatchlistButton = ({
isInWatchlist,
isLoading,
onClick,
}) => {
return (
<Button
colorScheme={isInWatchlist ? 'yellow' : 'teal'}
variant={isInWatchlist ? 'solid' : 'outline'}
size="lg"
onClick={onClick}
leftIcon={<StarIcon />}
isLoading={isLoading}
>
{isInWatchlist ? '已关注' : '关注'}
</Button>
);
};
export default WatchlistButton;