mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
fix: header ui styles (#4156)
This commit is contained in:
@@ -64,8 +64,14 @@ export const Header = forwardRef<HTMLDivElement, HeaderPros>(function Header(
|
|||||||
block: isTinyScreen,
|
block: isTinyScreen,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<div className={clsx(style.headerItem, 'top-item')}>
|
<div
|
||||||
<div ref={sidebarSwitchRef} style={{ marginRight: open ? 0 : 20 }}>
|
className={clsx(
|
||||||
|
style.headerItem,
|
||||||
|
'top-item',
|
||||||
|
!open ? 'top-item-visible' : ''
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div ref={sidebarSwitchRef}>
|
||||||
<SidebarSwitch show={!open} />
|
<SidebarSwitch show={!open} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ export const headerItem = style({
|
|||||||
'&.top-item': {
|
'&.top-item': {
|
||||||
height: '52px',
|
height: '52px',
|
||||||
},
|
},
|
||||||
|
'&.top-item-visible': {
|
||||||
|
marginRight: '20px',
|
||||||
|
},
|
||||||
'&.left': {
|
'&.left': {
|
||||||
justifyContent: 'left',
|
justifyContent: 'left',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ async function createWindow() {
|
|||||||
: isWindows()
|
: isWindows()
|
||||||
? 'hidden'
|
? 'hidden'
|
||||||
: 'default',
|
: 'default',
|
||||||
trafficLightPosition: { x: 20, y: 18 },
|
trafficLightPosition: { x: 20, y: 16 },
|
||||||
x: mainWindowState.x,
|
x: mainWindowState.x,
|
||||||
y: mainWindowState.y,
|
y: mainWindowState.y,
|
||||||
width: mainWindowState.width,
|
width: mainWindowState.width,
|
||||||
|
|||||||
@@ -45,6 +45,18 @@ export const navWrapperStyle = style({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const navHeaderButton = style({
|
||||||
|
width: '32px',
|
||||||
|
height: '32px',
|
||||||
|
flexShrink: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const navHeaderNavigationButtons = style({
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
columnGap: '32px',
|
||||||
|
});
|
||||||
|
|
||||||
export const navStyle = style({
|
export const navStyle = style({
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@@ -61,11 +73,10 @@ export const navHeaderStyle = style({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: '32px',
|
|
||||||
WebkitAppRegion: 'drag',
|
WebkitAppRegion: 'drag',
|
||||||
selectors: {
|
selectors: {
|
||||||
'&[data-is-macos-electron="true"]': {
|
'&[data-is-macos-electron="true"]': {
|
||||||
justifyContent: 'flex-end',
|
paddingLeft: '90px',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as ComplexStyleRule);
|
} as ComplexStyleRule);
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import { IconButton } from '@toeverything/components/button';
|
|||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
|
|
||||||
import type { History } from '..';
|
import type { History } from '..';
|
||||||
import { navHeaderStyle } from '../index.css';
|
import {
|
||||||
|
navHeaderButton,
|
||||||
|
navHeaderNavigationButtons,
|
||||||
|
navHeaderStyle,
|
||||||
|
} from '../index.css';
|
||||||
import { appSidebarOpenAtom } from '../index.jotai';
|
import { appSidebarOpenAtom } from '../index.jotai';
|
||||||
import { SidebarSwitch } from './sidebar-switch';
|
import { SidebarSwitch } from './sidebar-switch';
|
||||||
|
|
||||||
@@ -18,15 +22,16 @@ export type SidebarHeaderProps = {
|
|||||||
export const SidebarHeader = (props: SidebarHeaderProps) => {
|
export const SidebarHeader = (props: SidebarHeaderProps) => {
|
||||||
const open = useAtomValue(appSidebarOpenAtom);
|
const open = useAtomValue(appSidebarOpenAtom);
|
||||||
return (
|
return (
|
||||||
<div className={navHeaderStyle} data-open={open}>
|
<div
|
||||||
{environment.isDesktop && environment.isMacOs && (
|
className={navHeaderStyle}
|
||||||
<div style={{ flex: 1 }} />
|
data-open={open}
|
||||||
)}
|
data-is-macos-electron={environment.isDesktop && environment.isMacOs}
|
||||||
|
>
|
||||||
<SidebarSwitch show={open} />
|
<SidebarSwitch show={open} />
|
||||||
{environment.isDesktop && (
|
{environment.isDesktop && (
|
||||||
<>
|
<div className={navHeaderNavigationButtons}>
|
||||||
{!environment.isMacOs && <div style={{ flex: 1 }} />}
|
|
||||||
<IconButton
|
<IconButton
|
||||||
|
className={navHeaderButton}
|
||||||
data-testid="app-sidebar-arrow-button-back"
|
data-testid="app-sidebar-arrow-button-back"
|
||||||
disabled={props.router?.history.current === 0}
|
disabled={props.router?.history.current === 0}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -36,6 +41,7 @@ export const SidebarHeader = (props: SidebarHeaderProps) => {
|
|||||||
<ArrowLeftSmallIcon />
|
<ArrowLeftSmallIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
className={navHeaderButton}
|
||||||
data-testid="app-sidebar-arrow-button-forward"
|
data-testid="app-sidebar-arrow-button-forward"
|
||||||
disabled={
|
disabled={
|
||||||
props.router
|
props.router
|
||||||
@@ -50,7 +56,7 @@ export const SidebarHeader = (props: SidebarHeaderProps) => {
|
|||||||
>
|
>
|
||||||
<ArrowRightSmallIcon />
|
<ArrowRightSmallIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ export const sidebarSwitch = style({
|
|||||||
width: 0,
|
width: 0,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
pointerEvents: 'none',
|
pointerEvents: 'none',
|
||||||
transition: 'opacity .3s ease-in-out',
|
transition: 'all .3s ease-in-out',
|
||||||
selectors: {
|
selectors: {
|
||||||
'&[data-show=true]': {
|
'&[data-show=true]': {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
width: '32px',
|
width: '32px',
|
||||||
|
flexShrink: 0,
|
||||||
pointerEvents: 'auto',
|
pointerEvents: 'auto',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user