mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(electron): drag window behavior in header
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { baseTheme } from '@toeverything/theme';
|
||||
import type { ComplexStyleRule } from '@vanilla-extract/css';
|
||||
import { createVar, style } from '@vanilla-extract/css';
|
||||
|
||||
export const floatingMaxWidth = 768;
|
||||
@@ -49,12 +50,21 @@ export const navHeaderStyle = style({
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
'@media': {
|
||||
[`(max-width: ${floatingMaxWidth}px)`]: {
|
||||
selectors: {
|
||||
'&[data-open="true"]': {
|
||||
WebkitAppRegion: 'no-drag',
|
||||
},
|
||||
},
|
||||
} as ComplexStyleRule,
|
||||
},
|
||||
selectors: {
|
||||
'&[data-is-macos-electron="true"]': {
|
||||
justifyContent: 'flex-end',
|
||||
},
|
||||
},
|
||||
});
|
||||
} as ComplexStyleRule);
|
||||
|
||||
export const navBodyStyle = style({
|
||||
flex: '1 1 auto',
|
||||
|
||||
@@ -58,6 +58,7 @@ export const AppSidebar = forwardRef<HTMLElement, AppSidebarProps>(
|
||||
<div
|
||||
className={navHeaderStyle}
|
||||
data-is-macos-electron={isMacosDesktop}
|
||||
data-open={open}
|
||||
>
|
||||
{isMacosDesktop && (
|
||||
<>
|
||||
|
||||
@@ -43,6 +43,7 @@ export const StyledIconButton = styled('button', {
|
||||
width,
|
||||
height,
|
||||
fontSize,
|
||||
WebkitAppRegion: 'no-drag',
|
||||
color: 'var(--affine-icon-color)',
|
||||
...displayInlineFlex('center', 'center'),
|
||||
position: 'relative',
|
||||
@@ -184,6 +185,7 @@ export const StyledButton = styled('button', {
|
||||
paddingLeft: padding,
|
||||
paddingRight: padding,
|
||||
border: noBorder ? 'none' : '1px solid',
|
||||
WebkitAppRegion: 'no-drag',
|
||||
...displayInlineFlex('center', 'center'),
|
||||
position: 'relative',
|
||||
// TODO: disabled color is not decided
|
||||
|
||||
Reference in New Issue
Block a user