feat: 添加Company 页面头部组件 CompanyHeader
index.js # 组合导出 SearchBar.js # 股票搜索栏 WatchlistButton.js # 自选股按钮
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user