chore: add border for header when in edgeless page (#2239)

This commit is contained in:
JimmFly
2023-05-07 08:00:04 +08:00
committed by GitHub
parent aaa4b4f0cb
commit 29cbbf5c97
2 changed files with 8 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ import {
useState, useState,
} from 'react'; } from 'react';
import { useCurrentMode } from '../../../hooks/current/use-current-mode';
import type { AffineOfficialWorkspace } from '../../../shared'; import type { AffineOfficialWorkspace } from '../../../shared';
import { EditorOptionMenu } from './header-right-items/EditorOptionMenu'; import { EditorOptionMenu } from './header-right-items/EditorOptionMenu';
import EditPage from './header-right-items/EditPage'; import EditPage from './header-right-items/EditPage';
@@ -135,6 +136,7 @@ export const Header = forwardRef<
const [open] = useAtom(appSidebarOpenAtom); const [open] = useAtom(appSidebarOpenAtom);
const t = useAFFiNEI18N(); const t = useAFFiNEI18N();
const mode = useCurrentMode();
return ( return (
<StyledHeaderContainer <StyledHeaderContainer
ref={ref} ref={ref}
@@ -152,6 +154,7 @@ export const Header = forwardRef<
hasWarning={showWarning} hasWarning={showWarning}
data-testid="editor-header-items" data-testid="editor-header-items"
data-tauri-drag-region data-tauri-drag-region
isEdgeless={mode === 'edgeless'}
> >
<Suspense> <Suspense>
<SidebarSwitch <SidebarSwitch

View File

@@ -23,7 +23,10 @@ export const StyledHeaderContainer = styled('div')<{
}, },
}; };
}); });
export const StyledHeader = styled('div')<{ hasWarning: boolean }>(() => { export const StyledHeader = styled('div')<{
hasWarning: boolean;
isEdgeless: boolean;
}>(({ isEdgeless }) => {
return { return {
flexShrink: 0, flexShrink: 0,
height: '52px', height: '52px',
@@ -33,6 +36,7 @@ export const StyledHeader = styled('div')<{ hasWarning: boolean }>(() => {
background: 'var(--affine-background-primary-color)', background: 'var(--affine-background-primary-color)',
zIndex: 99, zIndex: 99,
position: 'relative', position: 'relative',
borderBottom: isEdgeless ? '1px solid var(--affine-border-color)' : 'none',
}; };
}); });