Не подтверждена Коммит 5352736e создал по автору Peng Xiao's avatar Peng Xiao
Просмотр файлов

feat(component): new right sidebar (#5169)

Refactor AFFiNE layout to support new right sidebar.

The new layout:
![image](https://github.com/toeverything/AFFiNE/assets/584378/678a05f5-bd48-4dbe-ad78-7a0bcc979918)

**Highlights:**
- new sidebar UI/UX
- favoring top-down UI components that are composed by basic building blocks in each route, instead of creating universal component like `WorkspaceHeader` that renders every possible cases (which I think is really hard to maintain)
- remove plugin based solution

**Pros/cons for current plugin-based solution:**

The current solution is somewhat a Dependency Injection (DI) approach, where the layout is defined at the top and UI items can be injected using Jotai atom slots.
This approach works well if we want a fully configurable system with everything being handled by plugins. It provides flexibility for custom extensions.
However, this solution is more suitable for single-page applications where the UI is completely controlled by configuration. It becomes challenging to achieve an optimized and visually appealing UI that remains under our control. An example of such a scenario would be a customizable dashboard like Grafana.
Another drawback of the existing solution is that we need to use Jotai and hooks to access context values, resulting in an unclear data flow within the component hierarchy.

**Alternatively, our approach in this PR** provides layout building blocks such as headers and sidebars, which can then be composed in individual route components. The good is that we have cleaner biz component instead of vague all-in-one layout component (like `<WorkspaceHeader />`).

**Issues of the implementation in this PR:**
Some UI layouts that that seems to be defined at the root layout are now defined in individual route component instead.
New 3-col layout component like the right sidebar still needs some abstraction and they are right now just for the detail editor only.
владелец 980831f9
import type { EditorContainer } from '@blocksuite/presets';
import type { Page } from '@blocksuite/store';
import type {
ActiveDocProvider,
PassiveDocProvider,
......@@ -134,18 +132,6 @@ type UIBaseProps<_Flavour extends keyof WorkspaceRegistry> = {
currentWorkspaceId: string;
};
export type WorkspaceHeaderProps<Flavour extends keyof WorkspaceRegistry> =
UIBaseProps<Flavour> & {
rightSlot?: ReactNode;
currentEntry:
| {
subPath: WorkspaceSubPath;
}
| {
pageId: string;
};
};
type NewSettingProps<Flavour extends keyof WorkspaceRegistry> =
UIBaseProps<Flavour> & {
onDeleteLocalWorkspace: () => void;
......@@ -161,18 +147,11 @@ type NewSettingProps<Flavour extends keyof WorkspaceRegistry> =
) => void;
};
type PageDetailProps<Flavour extends keyof WorkspaceRegistry> =
UIBaseProps<Flavour> & {
currentPageId: string;
onLoadEditor: (page: Page, editor: EditorContainer) => () => void;
};
interface FC<P> {
(props: P): ReactNode;
}
export interface WorkspaceUISchema<Flavour extends keyof WorkspaceRegistry> {
PageDetail: FC<PageDetailProps<Flavour>>;
NewSettingsDetail: FC<NewSettingProps<Flavour>>;
Provider: FC<PropsWithChildren>;
LoginCard?: FC<object>;
......
......@@ -54,13 +54,11 @@ export const mainContainerStyle = style({
width: 0,
flex: 1,
maxWidth: '100%',
backgroundColor: 'var(--affine-background-primary-color)',
selectors: {
'&[data-show-padding="true"]': {
margin: '8px',
borderRadius: '5px',
overflow: 'hidden',
boxShadow: 'var(--affine-shadow-1)',
'@media': {
print: {
overflow: 'visible',
......@@ -72,12 +70,6 @@ export const mainContainerStyle = style({
'&[data-show-padding="true"][data-is-macos="true"]': {
borderRadius: '6px',
},
'&[data-in-trash-page="true"]': {
marginBottom: '66px',
},
'&[data-in-trash-page="true"][data-show-padding="true"]': {
marginBottom: '66px',
},
'&[data-show-padding="true"]:before': {
content: '""',
position: 'absolute',
......@@ -124,7 +116,7 @@ globalStyle(
);
export const toolStyle = style({
position: 'fixed',
position: 'absolute',
right: '30px',
bottom: '30px',
zIndex: 'var(--affine-z-index-popover)',
......@@ -143,20 +135,4 @@ export const toolStyle = style({
display: 'none',
},
},
selectors: {
'&[data-in-trash-page="true"]': {
bottom: '70px',
'@media': {
'screen and (max-width: 960px)': {
bottom: '80px',
},
'screen and (max-width: 640px)': {
bottom: '85px',
},
print: {
display: 'none',
},
},
},
},
});
......@@ -35,14 +35,13 @@ export const AppContainer = ({
export interface MainContainerProps extends HTMLAttributes<HTMLDivElement> {
className?: string;
padding?: boolean;
inTrashPage?: boolean;
}
export const MainContainer = forwardRef<
HTMLDivElement,
PropsWithChildren<MainContainerProps>
>(function MainContainer(
{ className, padding, inTrashPage, children, ...props },
{ className, padding, children, ...props },
ref
): ReactElement {
return (
......@@ -51,7 +50,6 @@ export const MainContainer = forwardRef<
className={clsx(mainContainerStyle, className)}
data-is-macos={environment.isDesktop && environment.isMacOs}
data-show-padding={!!padding}
data-in-trash-page={!!inTrashPage}
ref={ref}
>
{children}
......@@ -61,14 +59,8 @@ export const MainContainer = forwardRef<
MainContainer.displayName = 'MainContainer';
export const ToolContainer = (
props: PropsWithChildren & { inTrashPage: boolean }
): ReactElement => {
return (
<div className={toolStyle} data-in-trash-page={!!props.inTrashPage}>
{props.children}
</div>
);
export const ToolContainer = (props: PropsWithChildren): ReactElement => {
return <div className={toolStyle}>{props.children}</div>;
};
export const WorkspaceFallback = (): ReactElement => {
......
......@@ -6,6 +6,7 @@ export const button = style({
alignItems: 'center',
userSelect: 'none',
touchAction: 'manipulation',
flexShrink: 0,
outline: '0',
border: '1px solid',
padding: '0 18px',
......
import { PageNotFoundError } from '@affine/env/constant';
import type {
WorkspaceFlavour,
WorkspaceUISchema,
} from '@affine/env/workspace';
import { lazy, useCallback } from 'react';
import { lazy } from 'react';
import type { OnLoadEditor } from '../../components/page-detail-editor';
import { useCurrentUser } from '../../hooks/affine/use-current-user';
import { useIsWorkspaceOwner } from '../../hooks/affine/use-is-workspace-owner';
import { useWorkspace } from '../../hooks/use-workspace';
import {
NewWorkspaceSettingDetail,
PageDetailEditor,
Provider,
} from '../shared';
import { NewWorkspaceSettingDetail, Provider } from '../shared';
const LoginCard = lazy(() =>
import('../../components/cloud/login-card').then(({ LoginCard }) => ({
......@@ -24,36 +16,6 @@ const LoginCard = lazy(() =>
export const UI = {
Provider,
LoginCard,
PageDetail: ({ currentWorkspaceId, currentPageId, onLoadEditor }) => {
const workspace = useWorkspace(currentWorkspaceId);
const page = workspace.blockSuiteWorkspace.getPage(currentPageId);
if (!page) {
throw new PageNotFoundError(workspace.blockSuiteWorkspace, currentPageId);
}
// this should be safe because we are under cloud workspace adapter
const currentUser = useCurrentUser();
const onLoad = useCallback<OnLoadEditor>(
(...args) => {
const dispose = onLoadEditor(...args);
workspace.blockSuiteWorkspace.awarenessStore.awareness.setLocalStateField(
'user',
{
name: currentUser.name,
}
);
return dispose;
},
[currentUser, workspace, onLoadEditor]
);
return (
<PageDetailEditor
pageId={currentPageId}
onLoad={onLoad}
workspace={workspace.blockSuiteWorkspace}
/>
);
},
NewSettingsDetail: ({
currentWorkspaceId,
onTransformWorkspace,
......
import { DebugLogger } from '@affine/debug';
import {
DEFAULT_WORKSPACE_NAME,
PageNotFoundError,
} from '@affine/env/constant';
import { DEFAULT_WORKSPACE_NAME } from '@affine/env/constant';
import type { WorkspaceAdapter } from '@affine/env/workspace';
import {
LoadPriority,
......@@ -14,19 +11,13 @@ import {
saveWorkspaceToLocalStorage,
} from '@affine/workspace/local/crud';
import { getOrCreateWorkspace } from '@affine/workspace/manager';
import { getBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace';
import { getCurrentStore } from '@toeverything/infra/atom';
import { initEmptyPage } from '@toeverything/infra/blocksuite';
import { buildShowcaseWorkspace } from '@toeverything/infra/blocksuite';
import { useAtomValue } from 'jotai';
import { nanoid } from 'nanoid';
import { setPageModeAtom } from '../../atoms';
import {
NewWorkspaceSettingDetail,
PageDetailEditor,
Provider,
} from '../shared';
import { NewWorkspaceSettingDetail, Provider } from '../shared';
const logger = new DebugLogger('use-create-first-workspace');
......@@ -68,21 +59,6 @@ export const LocalAdapter: WorkspaceAdapter<WorkspaceFlavour.LOCAL> = {
CRUD,
UI: {
Provider,
PageDetail: ({ currentWorkspaceId, currentPageId, onLoadEditor }) => {
const [workspaceAtom] = getBlockSuiteWorkspaceAtom(currentWorkspaceId);
const workspace = useAtomValue(workspaceAtom);
const page = workspace.getPage(currentPageId);
if (!page) {
throw new PageNotFoundError(workspace, currentPageId);
}
return (
<PageDetailEditor
pageId={currentPageId}
onLoad={onLoadEditor}
workspace={workspace}
/>
);
},
NewSettingsDetail: ({
currentWorkspaceId,
onTransformWorkspace,
......
import { PageNotFoundError } from '@affine/env/constant';
import type { WorkspaceFlavour } from '@affine/env/workspace';
import { type WorkspaceUISchema } from '@affine/env/workspace';
import { useWorkspace } from '../../hooks/use-workspace';
import { PageDetailEditor, Provider } from '../shared';
import { Provider } from '../shared';
export const UI = {
Provider,
PageDetail: ({ currentWorkspaceId, currentPageId, onLoadEditor }) => {
const workspace = useWorkspace(currentWorkspaceId);
const page = workspace.blockSuiteWorkspace.getPage(currentPageId);
if (!page) {
throw new PageNotFoundError(workspace.blockSuiteWorkspace, currentPageId);
}
return (
<PageDetailEditor
pageId={currentPageId}
onLoad={onLoadEditor}
workspace={workspace.blockSuiteWorkspace}
/>
);
},
NewSettingsDetail: () => {
throw new Error('Not implemented');
},
......
......@@ -13,9 +13,3 @@ export const NewWorkspaceSettingDetail = lazy(() =>
})
)
);
export const PageDetailEditor = lazy(() =>
import('../components/page-detail-editor').then(({ PageDetailEditor }) => ({
default: PageDetailEditor,
}))
);
import { atom } from 'jotai/vanilla';
export const appHeaderAtom = atom<HTMLDivElement | null>(null);
export const mainContainerAtom = atom<HTMLDivElement | null>(null);
import { registerTOCComponents } from '@blocksuite/blocks';
registerTOCComponents(components => {
for (const compName in components) {
if (window.customElements.get(compName)) continue;
window.customElements.define(
compName,
components[compName as keyof typeof components]
);
}
});
import './register-blocksuite-components';
import { setupGlobal } from '@affine/env/global';
import type { WorkspaceAdapter } from '@affine/env/workspace';
import type { WorkspaceFlavour } from '@affine/env/workspace';
......
import { Suspense, useEffect } from 'react';
import { useCurrentLoginStatus } from '../../../hooks/affine/use-current-login-status';
import { useCurrentUser } from '../../../hooks/affine/use-current-user';
import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspace';
const SyncAwarenessInnerLoggedIn = () => {
const currentUser = useCurrentUser();
const [{ blockSuiteWorkspace: workspace }] = useCurrentWorkspace();
useEffect(() => {
if (currentUser && workspace) {
workspace.awarenessStore.awareness.setLocalStateField('user', {
name: currentUser.name,
// todo: add avatar?
});
return () => {
workspace.awarenessStore.awareness.setLocalStateField('user', null);
};
}
return;
}, [currentUser, workspace]);
return null;
};
const SyncAwarenessInner = () => {
const loginStatus = useCurrentLoginStatus();
if (loginStatus === 'authenticated') {
return <SyncAwarenessInnerLoggedIn />;
}
return null;
};
// todo: we could do something more interesting here, e.g., show where the current user is
export const SyncAwareness = () => {
return (
<Suspense>
<SyncAwarenessInner />
</Suspense>
);
};
import { ToolContainer } from '@affine/component/workspace';
import { HelpIsland } from '../../pure/help-island';
export const HubIsland = () => {
return (
<ToolContainer>
<HelpIsland />
</ToolContainer>
);
};
......@@ -14,7 +14,7 @@ type SharePageModalProps = {
page: Page;
};
export const SharePageModal = ({ workspace, page }: SharePageModalProps) => {
export const SharePageButton = ({ workspace, page }: SharePageModalProps) => {
const onTransformWorkspace = useOnTransformWorkspace();
const [open, setOpen] = useState(false);
......
......@@ -60,7 +60,7 @@ const LocalShareMenu = (props: ShareMenuProps) => {
modal: false,
}}
>
<Button data-testid="local-share-menu-button" type="plain">
<Button data-testid="local-share-menu-button" type="primary">
{t['com.affine.share-menu.shareButton']()}
</Button>
</Menu>
......@@ -86,7 +86,7 @@ const CloudShareMenu = (props: ShareMenuProps) => {
modal: false,
}}
>
<Button data-testid="cloud-share-menu-button" type="plain">
<Button data-testid="cloud-share-menu-button" type="primary">
<div
style={{
color: isSharedPage
......
......@@ -2,7 +2,7 @@ import { type ComplexStyleRule, style } from '@vanilla-extract/css';
export const headerTitleContainer = style({
display: 'flex',
justifyContent: 'center',
justifyContent: 'flex-start',
alignItems: 'center',
flexGrow: 1,
position: 'relative',
......
import { globalStyle, style } from '@vanilla-extract/css';
/**
* Editor container element layer should be lower than header and after auto
* The zIndex of header is 2, defined in packages/frontend/core/src/components/pure/header/style.css.tsx
*/
export const editorContainer = style({
position: 'relative',
zIndex: 0, // it will create stacking context to limit layer of child elements and be lower than after auto zIndex
});
export const pluginContainer = style({
height: '100%',
width: '100%',
});
export const editor = style({
height: '100%',
flex: 1,
overflow: 'auto',
selectors: {
'&.full-screen': {
vars: {
......
import './page-detail-editor.css';
import { PageNotFoundError } from '@affine/env/constant';
import type { LayoutNode } from '@affine/sdk/entry';
import { assertExists, DisposableGroup } from '@blocksuite/global/utils';
import type { EditorContainer } from '@blocksuite/presets';
import type { Page, Workspace } from '@blocksuite/store';
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite-workspace-page';
import {
addCleanup,
pluginEditorAtom,
pluginWindowAtom,
} from '@toeverything/infra/__internal__/plugin';
import { contentLayoutAtom, getCurrentStore } from '@toeverything/infra/atom';
import { pluginEditorAtom } from '@toeverything/infra/__internal__/plugin';
import { getCurrentStore } from '@toeverything/infra/atom';
import clsx from 'clsx';
import { useAtomValue } from 'jotai';
import type { CSSProperties, ReactElement } from 'react';
import {
memo,
startTransition,
Suspense,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
import type { CSSProperties } from 'react';
import { memo, Suspense, useCallback, useMemo, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { type PageMode, pageSettingFamily } from '../atoms';
......@@ -35,8 +20,6 @@ import { useAppSettingHelper } from '../hooks/affine/use-app-setting-helper';
import { useBlockSuiteMetaHelper } from '../hooks/affine/use-block-suite-meta-helper';
import { BlockSuiteEditor as Editor } from './blocksuite/block-suite-editor';
import * as styles from './page-detail-editor.css';
import { editorContainer, pluginContainer } from './page-detail-editor.css';
import { TrashButtonGroup } from './pure/trash-button-group';
declare global {
// eslint-disable-next-line no-var
......@@ -57,17 +40,14 @@ function useRouterHash() {
return useLocation().hash.substring(1);
}
const EditorWrapper = memo(function EditorWrapper({
const PageDetailEditorMain = memo(function PageDetailEditorMain({
workspace,
page,
pageId,
onLoad,
isPublic,
publishMode,
}: PageDetailEditorProps) {
const page = useBlockSuiteWorkspacePage(workspace, pageId);
if (!page) {
throw new PageNotFoundError(workspace, pageId);
}
}: PageDetailEditorProps & { page: Page }) {
const meta = useBlockSuitePageMeta(workspace).find(
meta => meta.id === pageId
);
......@@ -133,6 +113,9 @@ const EditorWrapper = memo(function EditorWrapper({
if (onLoad) {
disposableGroup.add(onLoad(page, editor));
}
// todo: remove the following
// for now this is required for the image-preview plugin to work
const rootStore = getCurrentStore();
const editorItems = rootStore.get(pluginEditorAtom);
let disposes: (() => void)[] = [];
......@@ -162,132 +145,23 @@ const EditorWrapper = memo(function EditorWrapper({
);
return (
<>
<Editor
className={clsx(styles.editor, {
'full-screen': appSettings.fullWidthLayout,
'is-public-page': isPublic,
})}
style={
{
'--affine-font-family': value,
} as CSSProperties
}
mode={mode}
page={page}
onModeChange={setEditorMode}
defaultSelectedBlockId={blockId}
onLoadEditor={onLoadEditor}
/>
{meta.trash && <TrashButtonGroup />}
</>
);
});
interface PluginContentAdapterProps {
windowItem: (div: HTMLDivElement) => () => void;
pluginName: string;
}
const PluginContentAdapter = memo<PluginContentAdapterProps>(
function PluginContentAdapter({ windowItem, pluginName }) {
const rootRef = useRef<HTMLDivElement | null>(null);
useEffect(() => {
const abortController = new AbortController();
const root = rootRef.current;
if (root) {
startTransition(() => {
if (abortController.signal.aborted) {
return;
}
const div = document.createElement('div');
const cleanup = windowItem(div);
root.append(div);
if (abortController.signal.aborted) {
cleanup();
div.remove();
} else {
const cl = () => {
cleanup();
div.remove();
};
const dispose = addCleanup(pluginName, cl);
abortController.signal.addEventListener('abort', () => {
window.setTimeout(() => {
dispose();
cl();
});
});
}
});
return () => {
abortController.abort();
};
<Editor
className={clsx(styles.editor, {
'full-screen': appSettings.fullWidthLayout,
'is-public-page': isPublic,
})}
style={
{
'--affine-font-family': value,
} as CSSProperties
}
return;
}, [pluginName, windowItem]);
return <div className={pluginContainer} ref={rootRef} />;
}
);
interface LayoutPanelProps {
node: LayoutNode;
editorProps: PageDetailEditorProps;
depth: number;
}
const LayoutPanel = memo(function LayoutPanel(
props: LayoutPanelProps
): ReactElement {
const { node, depth, editorProps } = props;
const windowItems = useAtomValue(pluginWindowAtom);
if (typeof node === 'string') {
if (node === 'editor') {
return <EditorWrapper {...editorProps} />;
} else {
const windowItem = windowItems[node];
return <PluginContentAdapter pluginName={node} windowItem={windowItem} />;
}
} else {
return (
<PanelGroup
direction={node.direction}
style={depth === 0 ? { height: 'calc(100% - 52px)' } : undefined}
className={depth === 0 ? editorContainer : undefined}
>
<Panel
defaultSizePercentage={node.splitPercentage}
style={{
maxWidth: node.maxWidth?.[0],
}}
>
<Suspense>
<LayoutPanel
node={node.first}
editorProps={editorProps}
depth={depth + 1}
/>
</Suspense>
</Panel>
<PanelResizeHandle />
<Panel
defaultSizePercentage={100 - node.splitPercentage}
style={{
overflow: 'scroll',
maxWidth: node.maxWidth?.[1],
}}
>
<Suspense>
<LayoutPanel
node={node.second}
editorProps={editorProps}
depth={depth + 1}
/>
</Suspense>
</Panel>
</PanelGroup>
);
}
mode={mode}
page={page}
onModeChange={setEditorMode}
defaultSelectedBlockId={blockId}
onLoadEditor={onLoadEditor}
/>
);
});
export const PageDetailEditor = (props: PageDetailEditorProps) => {
......@@ -297,27 +171,9 @@ export const PageDetailEditor = (props: PageDetailEditorProps) => {
throw new PageNotFoundError(workspace, pageId);
}
const layout = useAtomValue(contentLayoutAtom);
if (layout === 'editor') {
return (
<Suspense>
<PanelGroup
style={{ height: 'calc(100% - 52px)' }}
direction="horizontal"
className={editorContainer}
>
<Panel>
<EditorWrapper {...props} />
</Panel>
</PanelGroup>
</Suspense>
);
}
return (
<Suspense>
<LayoutPanel node={layout} editorProps={props} depth={0} />
<PageDetailEditorMain {...props} page={page} />
</Suspense>
);
};
......@@ -5,56 +5,51 @@ import {
} from '@affine/component/app-sidebar';
import { useIsTinyScreen } from '@toeverything/hooks/use-is-tiny-screen';
import clsx from 'clsx';
import { type Atom, useAtomValue } from 'jotai';
import { useAtomValue } from 'jotai';
import type { ReactNode } from 'react';
import { forwardRef, useRef } from 'react';
import { useCallback, useRef, useState } from 'react';
import * as style from './style.css';
import { WindowsAppControls } from './windows-app-controls';
interface HeaderPros {
left?: ReactNode;
right?: ReactNode;
center?: ReactNode;
mainContainerAtom: Atom<HTMLDivElement | null>;
bottomBorder?: boolean;
}
// The Header component is used to solve the following problems
// 1. Manage layout issues independently of page or business logic
// 2. Dynamic centered middle element (relative to the main-container), when the middle element is detected to collide with the two elements, the line wrapping process is performed
export const Header = forwardRef<HTMLDivElement, HeaderPros>(function Header(
{ left, center, right, mainContainerAtom, bottomBorder },
ref
) {
export const Header = ({ left, center, right, bottomBorder }: HeaderPros) => {
const sidebarSwitchRef = useRef<HTMLDivElement | null>(null);
const leftSlotRef = useRef<HTMLDivElement | null>(null);
const centerSlotRef = useRef<HTMLDivElement | null>(null);
const rightSlotRef = useRef<HTMLDivElement | null>(null);
const windowControlsRef = useRef<HTMLDivElement | null>(null);
const mainContainer = useAtomValue(mainContainerAtom);
const [headerRoot, setHeaderRoot] = useState<HTMLDivElement | null>(null);
const onSetHeaderRoot = useCallback((node: HTMLDivElement | null) => {
setHeaderRoot(node);
}, []);
const isTinyScreen = useIsTinyScreen({
mainContainer,
container: headerRoot,
leftStatic: sidebarSwitchRef,
leftSlot: [leftSlotRef],
centerDom: centerSlotRef,
rightSlot: [rightSlotRef],
rightStatic: windowControlsRef,
});
const isWindowsDesktop = environment.isDesktop && environment.isWindows;
const open = useAtomValue(appSidebarOpenAtom);
const appSidebarFloating = useAtomValue(appSidebarFloatingAtom);
return (
<div
className={clsx(style.header, bottomBorder && style.bottomBorder)}
// data-has-warning={showWarning}
data-open={open}
data-sidebar-floating={appSidebarFloating}
data-testid="header"
ref={ref}
ref={onSetHeaderRoot}
>
<div
className={clsx(style.headerSideContainer, {
......@@ -79,7 +74,6 @@ export const Header = forwardRef<HTMLDivElement, HeaderPros>(function Header(
<div
className={clsx({
[style.headerCenter]: center,
'is-window': isWindowsDesktop,
})}
ref={centerSlotRef}
>
......@@ -90,17 +84,16 @@ export const Header = forwardRef<HTMLDivElement, HeaderPros>(function Header(
block: isTinyScreen,
})}
>
<div className={clsx(style.headerItem, 'top-item')}>
<div ref={windowControlsRef}>
{isWindowsDesktop ? <WindowsAppControls /> : null}
</div>
</div>
<div className={clsx(style.headerItem, 'right')}>
<div ref={rightSlotRef}>{right}</div>
<div ref={rightSlotRef} className={clsx(style.headerItem, 'right')}>
{right}
</div>
</div>
</div>
);
});
};
Header.displayName = 'Header';
export const HeaderDivider = () => {
return <div className={style.headerDivider} />;
};
......@@ -62,9 +62,6 @@ export const headerCenter = style({
left: '50%',
zIndex: 1,
selectors: {
'&.is-window': {
maxWidth: '50%',
},
'&.shadow': {
position: 'static',
visibility: 'hidden',
......@@ -89,9 +86,6 @@ export const headerSideContainer = style({
export const windowAppControlsWrapper = style({
display: 'flex',
marginLeft: '20px',
// header padding right
transform: 'translateX(16px)',
});
export const windowAppControl = style({
......@@ -118,3 +112,10 @@ export const windowAppControl = style({
},
},
} as ComplexStyleRule);
export const headerDivider = style({
height: '20px',
width: '1px',
background: 'var(--affine-border-color)',
margin: '0 12px',
});
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать