From e17f36e7b75eb44e87bf4fd6cbb30e46d155fbab Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Thu, 12 Dec 2024 20:31:40 +0800 Subject: [PATCH] fix: Correct inner padding and sider visibility logic in HeaderBar, PageLayout, and SiderBar components - Updated the click handler in HeaderBar to toggle inner padding and sider visibility correctly based on the selected item. - Adjusted the conditional rendering of SiderBar in PageLayout to ensure it displays when the sider is shown. - Refined the inner padding logic in SiderBar to maintain consistent behavior when selecting items. - Introduced a new function in Style context to manage sider visibility based on the current pathname, enhancing responsiveness to navigation changes. --- web/src/components/HeaderBar.js | 10 +++++----- web/src/components/PageLayout.js | 4 ++-- web/src/components/SiderBar.js | 4 ++-- web/src/context/Style/index.js | 20 ++++++++++++++++++++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/web/src/components/HeaderBar.js b/web/src/components/HeaderBar.js index 6234d867..1ddf24e9 100644 --- a/web/src/components/HeaderBar.js +++ b/web/src/components/HeaderBar.js @@ -124,11 +124,11 @@ const HeaderBar = () => { return (
{ if (props.itemKey === 'home') { - styleDispatch({ type: 'SET_INNER_PADDING', payload: true }); - styleDispatch({ type: 'SET_SIDER', payload: true }); - } else { styleDispatch({ type: 'SET_INNER_PADDING', payload: false }); styleDispatch({ type: 'SET_SIDER', payload: false }); + } else { + styleDispatch({ type: 'SET_INNER_PADDING', payload: true }); + styleDispatch({ type: 'SET_SIDER', payload: true }); } }}> { { styleState.showSider ?