From cc4ecf4c76e8b51872e140570daf55eaf892cb97 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Tue, 30 Dec 2025 10:24:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=80=E7=BA=A7?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E8=8F=9C=E5=8D=95=E5=B1=95=E5=BC=80=E6=97=B6?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=A2=9C=E8=89=B2=E6=B6=88=E5=A4=B1=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 getMenuButtonStyle 函数统一管理 MenuButton 样式 - 为所有 MenuButton 添加 _expanded 状态样式 - 菜单展开时保持浅色主题(背景 gray.100,文字 gray.700) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../Navbars/components/Navigation/DesktopNav.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/Navbars/components/Navigation/DesktopNav.js b/src/components/Navbars/components/Navigation/DesktopNav.js index e644c804..7dea5129 100644 --- a/src/components/Navbars/components/Navigation/DesktopNav.js +++ b/src/components/Navbars/components/Navigation/DesktopNav.js @@ -44,6 +44,12 @@ const DesktopNav = memo(({ isAuthenticated, user }) => { _focus: { bg: 'gray.100', color: 'gray.900' }, }; + // MenuButton 通用样式(菜单展开时保持浅色主题) + const getMenuButtonStyle = (isActiveState) => ({ + _hover: { bg: isActiveState ? 'blue.700' : 'gray.100' }, + _expanded: { bg: isActiveState ? 'blue.700' : 'gray.100', color: isActiveState ? 'white' : menuTextColor }, + }); + // 🎯 初始化导航埋点Hook const navEvents = useNavigationEvents({ component: 'top_nav' }); @@ -74,7 +80,7 @@ const DesktopNav = memo(({ isAuthenticated, user }) => { border={isActive(['/community', '/concepts']) ? '2px solid' : 'none'} borderColor={isActive(['/community', '/concepts']) ? 'blue.300' : 'transparent'} borderRadius="md" - _hover={{ bg: isActive(['/community', '/concepts']) ? 'blue.700' : 'gray.50' }} + {...getMenuButtonStyle(isActive(['/community', '/concepts']))} onMouseEnter={highFreqMenu.handleMouseEnter} onMouseLeave={highFreqMenu.handleMouseLeave} onClick={highFreqMenu.handleClick} @@ -146,7 +152,7 @@ const DesktopNav = memo(({ isAuthenticated, user }) => { border={isActive(['/limit-analyse', '/stocks', '/trading-simulation']) ? '2px solid' : 'none'} borderColor={isActive(['/limit-analyse', '/stocks', '/trading-simulation']) ? 'blue.300' : 'transparent'} borderRadius="md" - _hover={{ bg: isActive(['/limit-analyse', '/stocks', '/trading-simulation']) ? 'blue.700' : 'gray.50' }} + {...getMenuButtonStyle(isActive(['/limit-analyse', '/stocks', '/trading-simulation']))} onMouseEnter={marketReviewMenu.handleMouseEnter} onMouseLeave={marketReviewMenu.handleMouseLeave} onClick={marketReviewMenu.handleClick} @@ -224,7 +230,7 @@ const DesktopNav = memo(({ isAuthenticated, user }) => { border={isActive(['/agent-chat', '/value-forum']) ? '2px solid' : 'none'} borderColor={isActive(['/agent-chat', '/value-forum']) ? 'blue.300' : 'transparent'} borderRadius="md" - _hover={{ bg: isActive(['/agent-chat', '/value-forum']) ? 'blue.700' : 'gray.50' }} + {...getMenuButtonStyle(isActive(['/agent-chat', '/value-forum']))} onMouseEnter={agentCommunityMenu.handleMouseEnter} onMouseLeave={agentCommunityMenu.handleMouseLeave} onClick={agentCommunityMenu.handleClick} @@ -300,7 +306,7 @@ const DesktopNav = memo(({ isAuthenticated, user }) => { variant="ghost" color={menuTextColor} rightIcon={} - _hover={{ bg: 'gray.50' }} + {...getMenuButtonStyle(false)} onMouseEnter={contactUsMenu.handleMouseEnter} onMouseLeave={contactUsMenu.handleMouseLeave} onClick={contactUsMenu.handleClick}