diff --git a/apps/electron/layers/main/src/main-window.ts b/apps/electron/layers/main/src/main-window.ts index 7e39cc325..0a98e0bdb 100644 --- a/apps/electron/layers/main/src/main-window.ts +++ b/apps/electron/layers/main/src/main-window.ts @@ -14,7 +14,7 @@ async function createWindow() { const browserWindow = new BrowserWindow({ titleBarStyle: isMacOS() ? 'hiddenInset' : 'default', - trafficLightPosition: { x: 20, y: 18 }, + trafficLightPosition: { x: 24, y: 18 }, x: mainWindowState.x, y: mainWindowState.y, width: mainWindowState.width, diff --git a/apps/web/src/components/affine/pinboard/styles.ts b/apps/web/src/components/affine/pinboard/styles.ts index b8443a383..5f826707c 100644 --- a/apps/web/src/components/affine/pinboard/styles.ts +++ b/apps/web/src/components/affine/pinboard/styles.ts @@ -12,7 +12,8 @@ export const StyledCollapsedButton = styled('button')<{ }>(({ collapse, show = true, theme }) => { return { width: '16px', - height: '16px', + height: '100%', + ...displayFlex('center', 'center'), fontSize: '16px', position: 'absolute', left: '0', @@ -21,9 +22,13 @@ export const StyledCollapsedButton = styled('button')<{ margin: 'auto', color: theme.colors.iconColor, opacity: '.6', + transition: 'opacity .15s ease-in-out', display: show ? 'flex' : 'none', svg: { - transform: `rotate(${collapse ? '0' : '-90'}deg)`, + transform: `rotate(${collapse ? '-90' : '0'}deg)`, + }, + ':hover': { + opacity: '1', }, }; }); diff --git a/apps/web/src/components/pure/quick-search-modal/navigation-path/index.tsx b/apps/web/src/components/pure/quick-search-modal/navigation-path/index.tsx index e6ed4b375..d28e91678 100644 --- a/apps/web/src/components/pure/quick-search-modal/navigation-path/index.tsx +++ b/apps/web/src/components/pure/quick-search-modal/navigation-path/index.tsx @@ -103,7 +103,7 @@ export const NavigationPath = ({ > { setOpenExtend(!openExtend); @@ -158,9 +158,7 @@ const NavigationPathExtendPanel = ({ show={open} data-testid="navigation-path-expand-panel" > -
- -
+ ); }; diff --git a/apps/web/src/components/pure/quick-search-modal/navigation-path/styles.ts b/apps/web/src/components/pure/quick-search-modal/navigation-path/styles.ts index d6b70dd24..4ad6cfeea 100644 --- a/apps/web/src/components/pure/quick-search-modal/navigation-path/styles.ts +++ b/apps/web/src/components/pure/quick-search-modal/navigation-path/styles.ts @@ -55,12 +55,7 @@ export const StyledNavPathExtendContainer = styled('div')<{ show: boolean }>( transition: 'top .15s', fontSize: theme.font.sm, color: theme.colors.secondaryTextColor, - paddingTop: '46px', - paddingRight: '12px', - - '.tree-container': { - padding: '0 12px 0 15px', - }, + padding: '46px 12px 0 15px', }; } ); diff --git a/apps/web/src/components/pure/quick-search-modal/navigation-path/utils.ts b/apps/web/src/components/pure/quick-search-modal/navigation-path/utils.ts index 58b9c06fc..80499dd38 100644 --- a/apps/web/src/components/pure/quick-search-modal/navigation-path/utils.ts +++ b/apps/web/src/components/pure/quick-search-modal/navigation-path/utils.ts @@ -3,7 +3,7 @@ import type { PageMeta } from '@blocksuite/store'; export function findPath(metas: PageMeta[], meta: PageMeta): PageMeta[] { function helper(group: PageMeta[]): PageMeta[] { const last = group[group.length - 1]; - const parent = metas.find(m => m.subpageIds.includes(last.id)); + const parent = metas.find(m => (m.subpageIds ?? []).includes(last.id)); if (parent) { return helper([...group, parent]); } diff --git a/apps/web/src/components/pure/workspace-slider-bar/RouteNavigation.tsx b/apps/web/src/components/pure/workspace-slider-bar/RouteNavigation.tsx new file mode 100644 index 000000000..0224f3730 --- /dev/null +++ b/apps/web/src/components/pure/workspace-slider-bar/RouteNavigation.tsx @@ -0,0 +1,31 @@ +import { IconButton } from '@affine/component'; +import { ArrowLeftSmallIcon, ArrowRightSmallIcon } from '@blocksuite/icons'; + +import { StyledRouteNavigationWrapper } from './shared-styles'; + +export const RouteNavigation = () => { + if (!environment.isDesktop) { + return <>; + } + return ( + + { + window.history.back(); + }} + > + + + { + window.history.forward(); + }} + style={{ marginLeft: '32px' }} + > + + + + ); +}; diff --git a/apps/web/src/components/pure/workspace-slider-bar/index.tsx b/apps/web/src/components/pure/workspace-slider-bar/index.tsx index 7c47198bd..71456eb82 100644 --- a/apps/web/src/components/pure/workspace-slider-bar/index.tsx +++ b/apps/web/src/components/pure/workspace-slider-bar/index.tsx @@ -26,12 +26,13 @@ import { SidebarSwitch } from '../../affine/sidebar-switch'; import { ChangeLog } from './changeLog'; import Favorite from './favorite'; import { Pinboard } from './Pinboard'; +import { RouteNavigation } from './RouteNavigation'; import { StyledListItem } from './shared-styles'; import { StyledLink, StyledNewPageButton, StyledScrollWrapper, - StyledSidebarSwitchWrapper, + StyledSidebarHeader, StyledSliderBar, StyledSliderBarInnerWrapper, StyledSliderBarWrapper, @@ -115,13 +116,14 @@ export const WorkSpaceSliderBar: React.FC = ({ data-testid="sliderBar-root" > - + + - + = ({ {t('Quick search')} - = ({ {t('Workspace Settings')} - = ({ {t('All pages')} - ) => { @@ -199,7 +198,7 @@ export const WorkSpaceSliderBar: React.FC = ({ /> )} - +
{currentWorkspace?.flavour === WorkspaceFlavour.AFFINE && currentWorkspace.public ? ( @@ -236,9 +235,6 @@ export const WorkSpaceSliderBar: React.FC = ({ currentPath === (currentWorkspaceId && paths.trash(currentWorkspaceId)) } - style={{ - marginTop: '16px', - }} > (({ collapse, show = true, theme }) => { return { width: '16px', - height: '16px', + height: '100%', + ...displayFlex('center', 'center'), fontSize: '16px', position: 'absolute', left: '0', @@ -53,10 +55,14 @@ export const StyledCollapseButton = styled('button')<{ margin: 'auto', color: theme.colors.iconColor, opacity: '.6', + transition: 'opacity .15s ease-in-out', display: show ? 'flex' : 'none', svg: { transform: `rotate(${collapse ? '0' : '-90'}deg)`, }, + ':hover': { + opacity: '1', + }, }; }); @@ -205,3 +211,10 @@ export const StyledChangeLogWrapper = styled('div')<{ overflow: 'hidden', }; }); + +export const StyledRouteNavigationWrapper = styled('div')({ + height: '32px', + width: '80px', + marginRight: '16px', + ...displayFlex('space-between', 'center'), +}); diff --git a/apps/web/src/components/pure/workspace-slider-bar/style.ts b/apps/web/src/components/pure/workspace-slider-bar/style.ts index b10701de0..a5aa47216 100644 --- a/apps/web/src/components/pure/workspace-slider-bar/style.ts +++ b/apps/web/src/components/pure/workspace-slider-bar/style.ts @@ -25,7 +25,7 @@ export const StyledSliderBarWrapper = styled('div')<{ }; }); -export const StyledSliderBar = styled('div')(({ theme }) => { +export const StyledSliderBar = styled('div')(() => { return { whiteSpace: 'nowrap', width: '100%', @@ -34,19 +34,18 @@ export const StyledSliderBar = styled('div')(({ theme }) => { flexShrink: 0, display: 'flex', flexDirection: 'column', - // overflow: 'hidden', }; }); -export const StyledSidebarSwitchWrapper = styled('div')(() => { +export const StyledSidebarHeader = styled('div')(() => { return { height: '52px', flexShrink: 0, - padding: '0 16px', + padding: '0 16px 0 10px', WebkitAppRegion: 'drag', button: { WebkitAppRegion: 'no-drag', }, - ...displayFlex(macosElectron ? 'flex-end' : 'flex-start', 'center'), + ...displayFlex(macosElectron ? 'flex-end' : 'space-between', 'center'), }; }); export const StyledSliderBarInnerWrapper = styled('div')(() => { @@ -55,6 +54,9 @@ export const StyledSliderBarInnerWrapper = styled('div')(() => { // overflowX: 'hidden', // overflowY: 'auto', position: 'relative', + height: 'calc(100% - 52px * 2)', + display: 'flex', + flexDirection: 'column', }; }); @@ -75,7 +77,7 @@ export const StyledNewPageButton = styled('button')(({ theme }) => { ...displayFlex('flex-start', 'center'), borderTop: '1px solid', borderColor: theme.colors.borderColor, - padding: '0 8px', + padding: '0 8px 0 16px', svg: { fontSize: '20px', color: theme.colors.iconColor, @@ -105,44 +107,11 @@ export const StyledSliderModalBackground = styled('div')<{ active: boolean }>( }; } ); -export const StyledSliderResizer = styled('div')<{ isResizing: boolean }>( - () => { - return { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - width: '12px', - transform: 'translateX(50%)', - cursor: 'col-resize', - zIndex: 1, - userSelect: 'none', - ':hover > *': { - background: 'rgba(0, 0, 0, 0.1)', - }, - }; - } -); -export const StyledSliderResizerInner = styled('div')<{ isResizing: boolean }>( - ({ isResizing }) => { - return { - transition: 'background .15s .1s', - position: 'absolute', - top: 0, - right: '50%', - bottom: 0, - transform: 'translateX(0.5px)', - width: '2px', - background: isResizing ? 'rgba(0, 0, 0, 0.1)' : 'transparent', - }; - } -); export const StyledScrollWrapper = styled('div')<{ showTopBorder: boolean; }>(({ showTopBorder, theme }) => { return { - maxHeight: '360px', overflowY: 'auto', borderTop: '1px solid', borderColor: showTopBorder ? theme.colors.borderColor : 'transparent', diff --git a/packages/component/src/ui/button/IconButton.tsx b/packages/component/src/ui/button/IconButton.tsx index 0a14d3ea2..d2b84f390 100644 --- a/packages/component/src/ui/button/IconButton.tsx +++ b/packages/component/src/ui/button/IconButton.tsx @@ -12,7 +12,7 @@ const SIZE_CONFIG = { areaSize: 20, }, [SIZE_MIDDLE]: { - iconSize: 16, + iconSize: 20, areaSize: 24, }, [SIZE_NORMAL]: {