From 42eb61434d227901d4ed96e2b8241dd088f6742a Mon Sep 17 00:00:00 2001 From: RieN 7z Date: Wed, 10 Sep 2025 03:56:48 +0800 Subject: [PATCH] fix: Navbar css (#10025) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: NavbarContainer padding-left in fullscreen * fix: use `NavbarIcon` in mac search icon * fix: NarrowIcon in KnowledgeContent * fix: Fix NavbarIcon & NarrowIcon for search & expand btn --------- Co-authored-by: 自由的世界人 <3196812536@qq.com> --- src/renderer/src/components/app/Navbar.tsx | 8 ++-- src/renderer/src/pages/home/Navbar.tsx | 38 +++++++++---------- .../src/pages/knowledge/KnowledgeContent.tsx | 10 +---- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/renderer/src/components/app/Navbar.tsx b/src/renderer/src/components/app/Navbar.tsx index 5b1807451b..41bad7260e 100644 --- a/src/renderer/src/components/app/Navbar.tsx +++ b/src/renderer/src/components/app/Navbar.tsx @@ -13,6 +13,7 @@ type Props = PropsWithChildren & HTMLAttributes export const Navbar: FC = ({ children, ...props }) => { const backgroundColor = useNavBackgroundColor() + const isFullscreen = useFullscreen() const { isTopNavbar } = useNavbarPosition() const { minappShow } = useRuntime() @@ -22,7 +23,7 @@ export const Navbar: FC = ({ children, ...props }) => { return ( <> - + {children} {!isTopNavbar && !minappShow && } @@ -60,14 +61,15 @@ export const NavbarHeader: FC = ({ children, ...props }) => { return {children} } -const NavbarContainer = styled.div` +const NavbarContainer = styled.div<{ $isFullScreen: boolean }>` min-width: 100%; display: flex; flex-direction: row; min-height: ${isMac ? 'env(titlebar-area-height)' : 'var(--navbar-height)'}; max-height: var(--navbar-height); margin-left: ${isMac ? 'calc(var(--sidebar-width) * -1)' : 0}; - padding-left: ${isMac ? 'env(titlebar-area-x)' : 0}; + padding-left: ${({ $isFullScreen }) => + isMac ? ($isFullScreen ? 'var(--sidebar-width)' : 'env(titlebar-area-x)') : 0}; -webkit-app-region: drag; ` diff --git a/src/renderer/src/pages/home/Navbar.tsx b/src/renderer/src/pages/home/Navbar.tsx index 20536e9321..51bf834149 100644 --- a/src/renderer/src/pages/home/Navbar.tsx +++ b/src/renderer/src/pages/home/Navbar.tsx @@ -86,26 +86,26 @@ const HeaderNavbar: FC = ({ activeAssistant, setActiveAssistant, activeTo )} {!showAssistants && ( - - toggleShowAssistants()} style={{ marginRight: 8, marginLeft: -12 }}> - - - - )} - - {!showAssistants && ( - - - + + + toggleShowAssistants()}> + - - )} - + + + + + + + + + + )} diff --git a/src/renderer/src/pages/knowledge/KnowledgeContent.tsx b/src/renderer/src/pages/knowledge/KnowledgeContent.tsx index 2adaaba728..8f75d3d45a 100644 --- a/src/renderer/src/pages/knowledge/KnowledgeContent.tsx +++ b/src/renderer/src/pages/knowledge/KnowledgeContent.tsx @@ -167,9 +167,9 @@ const KnowledgeContent: FC = ({ selectedBase }) => { {/* 使用selected base导致修改设置后没有响应式更新 */} - base && KnowledgeSearchPopup.show({ base: base })}> + base && KnowledgeSearchPopup.show({ base: base })}> - + @@ -290,12 +290,6 @@ const ModelInfo = styled.div` } ` -const NarrowIcon = styled(NavbarIcon)` - @media (max-width: 1000px) { - display: none; - } -` - export const ItemContainer = styled.div` display: flex; flex-direction: column;