diff --git a/src/views/Community/components/DynamicNewsCard/VerticalModeLayout.js b/src/views/Community/components/DynamicNewsCard/VerticalModeLayout.js index 54c381c9..46e8f251 100644 --- a/src/views/Community/components/DynamicNewsCard/VerticalModeLayout.js +++ b/src/views/Community/components/DynamicNewsCard/VerticalModeLayout.js @@ -1,8 +1,9 @@ // src/views/Community/components/DynamicNewsCard/VerticalModeLayout.js // 纵向分栏模式布局组件 -import React from 'react'; -import { Grid, GridItem } from '@chakra-ui/react'; +import React, { useState } from 'react'; +import { Grid, GridItem, IconButton, Tooltip } from '@chakra-ui/react'; +import { ViewIcon, ViewOffIcon } from '@chakra-ui/icons'; import HorizontalDynamicNewsEventCard from '../EventCard/HorizontalDynamicNewsEventCard'; import VirtualizedFourRowGrid from './VirtualizedFourRowGrid'; import EventDetailScrollPanel from './EventDetailScrollPanel'; @@ -44,8 +45,25 @@ const VerticalModeLayout = ({ scrollbarThumbBg, scrollbarThumbHoverBg, }) => { + // 布局模式状态:'detail' = 聚焦详情(默认),'list' = 聚焦列表 + const [layoutMode, setLayoutMode] = useState('detail'); + + // 切换布局模式 + const toggleLayoutMode = () => { + setLayoutMode(prev => prev === 'detail' ? 'list' : 'detail'); + }; + + // 根据模式计算 Grid 的 templateColumns + const gridTemplateColumns = layoutMode === 'detail' ? '1fr 2fr' : '3fr 150px'; + return ( - + {/* 左侧:事件列表 (33.3%) - 使用虚拟滚动 + 双向无限滚动 */} {/* 右侧:事件详情 (66.7%) */} - + + {/* 布局切换按钮 */} + + : } + onClick={toggleLayoutMode} + aria-label="切换布局模式" + colorScheme="blue" + variant="ghost" + /> + + + {/* 详情面板 */}