// src/views/Community/components/EventCard/EventFollowButton.js import React from 'react'; import { IconButton, Box } from '@chakra-ui/react'; import { AiFillStar, AiOutlineStar } from 'react-icons/ai'; /** * 事件关注按钮组件 * @param {Object} props * @param {boolean} props.isFollowing - 是否已关注 * @param {number} props.followerCount - 关注数 * @param {Function} props.onToggle - 切换关注状态的回调函数 * @param {string} props.size - 按钮尺寸('xs' | 'sm' | 'md',默认 'sm') * @param {boolean} props.showCount - 是否显示关注数(默认 true) */ const EventFollowButton = ({ isFollowing, followerCount = 0, onToggle, size = 'sm', showCount = true }) => { const iconSize = size === 'xs' ? '16px' : size === 'sm' ? '18px' : '22px'; const handleClick = (e) => { e.stopPropagation(); onToggle?.(); }; return ( ) : ( ) } onClick={handleClick} aria-label={isFollowing ? '取消关注' : '关注'} /> {/* {followerCount || 0} */} ); }; export default EventFollowButton;