feat: UI调整
This commit is contained in:
@@ -22,6 +22,11 @@ const StockChangeIndicators = ({
|
|||||||
return useColorModeValue('gray.700', 'gray.400');
|
return useColorModeValue('gray.700', 'gray.400');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0值使用中性灰色
|
||||||
|
if (value === 0) {
|
||||||
|
return 'gray.700';
|
||||||
|
}
|
||||||
|
|
||||||
const absValue = Math.abs(value);
|
const absValue = Math.abs(value);
|
||||||
const isPositive = value > 0;
|
const isPositive = value > 0;
|
||||||
|
|
||||||
@@ -48,6 +53,11 @@ const StockChangeIndicators = ({
|
|||||||
return useColorModeValue('gray.100', 'gray.700');
|
return useColorModeValue('gray.100', 'gray.700');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0值使用中性灰色背景
|
||||||
|
if (value === 0) {
|
||||||
|
return useColorModeValue('gray.100', 'gray.700');
|
||||||
|
}
|
||||||
|
|
||||||
const absValue = Math.abs(value);
|
const absValue = Math.abs(value);
|
||||||
const isPositive = value > 0;
|
const isPositive = value > 0;
|
||||||
|
|
||||||
@@ -74,6 +84,11 @@ const StockChangeIndicators = ({
|
|||||||
return useColorModeValue('gray.300', 'gray.600');
|
return useColorModeValue('gray.300', 'gray.600');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0值使用中性灰色边框
|
||||||
|
if (value === 0) {
|
||||||
|
return useColorModeValue('gray.300', 'gray.600');
|
||||||
|
}
|
||||||
|
|
||||||
const absValue = Math.abs(value);
|
const absValue = Math.abs(value);
|
||||||
const isPositive = value > 0;
|
const isPositive = value > 0;
|
||||||
|
|
||||||
@@ -99,7 +114,8 @@ const StockChangeIndicators = ({
|
|||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
|
|
||||||
const sign = value > 0 ? '+' : '';
|
const sign = value > 0 ? '+' : '';
|
||||||
const numStr = Math.abs(value).toFixed(1);
|
// 0值显示为 "0",其他值显示一位小数
|
||||||
|
const numStr = value === 0 ? '0' : Math.abs(value).toFixed(1);
|
||||||
const numberColor = getNumberColor(value);
|
const numberColor = getNumberColor(value);
|
||||||
const bgColor = getBgColor(value);
|
const bgColor = getBgColor(value);
|
||||||
const borderColor = getBorderColor(value);
|
const borderColor = getBorderColor(value);
|
||||||
|
|||||||
@@ -13,14 +13,18 @@ import {
|
|||||||
import { ViewIcon } from '@chakra-ui/icons';
|
import { ViewIcon } from '@chakra-ui/icons';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import StockChangeIndicators from '../../../../components/StockChangeIndicators';
|
import StockChangeIndicators from '../../../../components/StockChangeIndicators';
|
||||||
|
import EventFollowButton from '../EventCard/EventFollowButton';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件头部信息区组件
|
* 事件头部信息区组件
|
||||||
* @param {Object} props
|
* @param {Object} props
|
||||||
* @param {Object} props.event - 事件对象
|
* @param {Object} props.event - 事件对象
|
||||||
* @param {Object} props.importance - 重要性配置对象(包含 level, color 等)
|
* @param {Object} props.importance - 重要性配置对象(包含 level, color 等)
|
||||||
|
* @param {boolean} props.isFollowing - 是否已关注
|
||||||
|
* @param {number} props.followerCount - 关注数
|
||||||
|
* @param {Function} props.onToggleFollow - 切换关注回调
|
||||||
*/
|
*/
|
||||||
const EventHeaderInfo = ({ event, importance }) => {
|
const EventHeaderInfo = ({ event, importance, isFollowing, followerCount, onToggleFollow }) => {
|
||||||
const sectionBg = useColorModeValue('gray.50', 'gray.750');
|
const sectionBg = useColorModeValue('gray.50', 'gray.750');
|
||||||
const headingColor = useColorModeValue('gray.700', 'gray.200');
|
const headingColor = useColorModeValue('gray.700', 'gray.200');
|
||||||
|
|
||||||
@@ -64,12 +68,21 @@ const EventHeaderInfo = ({ event, importance }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 第一行:标题 */}
|
{/* 第一行:标题 + 关注按钮 */}
|
||||||
<Flex align="center" justify="space-between" mb={3} gap={4}>
|
<Flex align="center" justify="space-between" mb={3} gap={4}>
|
||||||
{/* 标题 */}
|
{/* 标题 */}
|
||||||
<Heading size="md" color={headingColor} flex={1}>
|
<Heading size="md" color={headingColor} flex={1}>
|
||||||
{event.title}
|
{event.title}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
|
{/* 关注按钮 */}
|
||||||
|
<EventFollowButton
|
||||||
|
isFollowing={isFollowing}
|
||||||
|
followerCount={followerCount}
|
||||||
|
onToggle={onToggleFollow}
|
||||||
|
size="sm"
|
||||||
|
showCount={true}
|
||||||
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
{/* 第二行:浏览数 + 日期 */}
|
{/* 第二行:浏览数 + 日期 */}
|
||||||
<Flex align="left" mb={3} gap={4}>
|
<Flex align="left" mb={3} gap={4}>
|
||||||
|
|||||||
Reference in New Issue
Block a user