Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

opti: style improve of sidebar and topbar #572;

mitsuhatu7820fd7b34de
diff --git a/apps/ligo-virgo/src/pages/workspace/index.tsx b/apps/ligo-virgo/src/pages/workspace/WorkspaceContainer.tsx
similarity index 100%
rename from apps/ligo-virgo/src/pages/workspace/index.tsx
rename to apps/ligo-virgo/src/pages/workspace/WorkspaceContainer.tsx
diff --git a/apps/ligo-virgo/src/pages/workspace/docs/index.tsx b/apps/ligo-virgo/src/pages/workspace/docs/Page.tsx
similarity index 98%
rename from apps/ligo-virgo/src/pages/workspace/docs/index.tsx
rename to apps/ligo-virgo/src/pages/workspace/docs/Page.tsx
index 4ccf9f199f..61f313a9cb 100644
--- a/apps/ligo-virgo/src/pages/workspace/docs/index.tsx
+++ b/apps/ligo-virgo/src/pages/workspace/docs/Page.tsx
@@ -68,6 +68,7 @@ export function Page(props: PageProps) {
!showSpaceSidebar && !fixedDisplay
? 'translateX(-270px)'
: 'translateX(0px)',
+ transition: '0.8s',
}}
onMouseEnter={() => setSpaceSidebarVisible(true)}
onMouseLeave={() => setSpaceSidebarVisible(false)}
@@ -144,12 +145,13 @@ const LigoLeftContainer = styled('div')({
const WorkspaceSidebar = styled('div')(({ hidden }) => ({
position: 'absolute',
+ bottom: '48px',
+ top: '0px',
zIndex: 1,
display: 'flex',
flexDirection: 'column',
width: 300,
minWidth: 300,
- height: '100%',
borderRadius: '0px 10px 10px 0px',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)',
backgroundColor: '#FFFFFF',
diff --git a/apps/ligo-virgo/src/pages/workspace/docs/index.ts b/apps/ligo-virgo/src/pages/workspace/docs/index.ts
new file mode 100644
index 0000000000..fc2e4f7384
--- /dev/null
+++ b/apps/ligo-virgo/src/pages/workspace/docs/index.ts
@@ -0,0 +1 @@
+export { Page } from './Page';
diff --git a/apps/ligo-virgo/src/pages/workspace/index.ts b/apps/ligo-virgo/src/pages/workspace/index.ts
new file mode 100644
index 0000000000..be53c56f82
--- /dev/null
+++ b/apps/ligo-virgo/src/pages/workspace/index.ts
@@ -0,0 +1 @@
+export { WorkspaceContainer } from './WorkspaceContainer';
diff --git a/libs/components/layout/src/header/LayoutHeader.tsx b/libs/components/layout/src/header/LayoutHeader.tsx
index 7f502ea906..1593ed9849 100644
--- a/libs/components/layout/src/header/LayoutHeader.tsx
+++ b/libs/components/layout/src/header/LayoutHeader.tsx
@@ -34,6 +34,7 @@ const StyledContainerForHeaderRoot = styled('div')(({ theme }) => {
return {
width: '100%',
zIndex: theme.affine.zIndex.header,
+ backgroundColor: '#fff',
};
});
diff --git a/libs/components/layout/src/header/Title.tsx b/libs/components/layout/src/header/Title.tsx
index 6c293709e7..16017e43f9 100644
--- a/libs/components/layout/src/header/Title.tsx
+++ b/libs/components/layout/src/header/Title.tsx
@@ -13,6 +13,8 @@ export const CurrentPageTitle = () => {
const { workspace_id } = params;
const [pageId, setPageId] = useState<string>('');
const [pageTitle, setPageTitle] = useState<string | undefined>();
+ /* card.7 */
+ // const { items } = usePageTree();
useEffect(() => {
if (params['*']) {
diff --git a/libs/components/layout/src/header/utils.ts b/libs/components/layout/src/header/utils.ts
new file mode 100644
index 0000000000..036333e645
--- /dev/null
+++ b/libs/components/layout/src/header/utils.ts
@@ -0,0 +1,25 @@
+import { TreeItem, TreeItems } from './../workspace-sidebar/page-tree';
+
+const pickPath = (treeItems: TreeItem | TreeItems, targetId: string) => {
+ const pick = (tree: TreeItem, result: TreeItem[] = []) => {
+ if (tree.id === targetId) {
+ result.push(tree);
+ return result;
+ }
+
+ for (const child of tree?.children || []) {
+ if (pick(child, result).length) {
+ result.unshift(tree);
+ break;
+ }
+ }
+
+ return result;
+ };
+
+ return (Array.isArray(treeItems) ? treeItems : [treeItems]).map(treeItem =>
+ pick(treeItem)
+ );
+};
+
+export { pickPath };
diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx
index 4769bde6b2..fe0b044db6 100755
--- a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx
+++ b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx
@@ -81,6 +81,8 @@ export const TreeItem = forwardRef<HTMLDivElement, TreeItemProps>(
style={
{
'--spacing': `${indentationWidth * depth}px`,
+ paddingTop: 0,
+ paddingBottom: 0,
} as CSSProperties
}
{...props}
@@ -94,30 +96,35 @@ export const TreeItem = forwardRef<HTMLDivElement, TreeItemProps>(
<Action onClick={onCollapse}>
{collapsed ? <ArrowRightIcon /> : <ArrowDropDownIcon />}
</Action>
- <Action>
- <DocumentIcon />
- </Action>
- <span
- className={styles['Text']}
- {...handleProps}
- onClick={() => {
- navigate(`/${workspace_id}/${pageId}`);
- }}
- >
- {value}
- </span>
- {BooleanPageTreeItemMoreActions && (
- <MoreActions
- workspaceId={workspace_id}
- pageId={pageId}
- onRemove={onRemove}
- />
- )}
+ {/*<Action>*/}
+ {/* <DocumentIcon />*/}
+ {/*</Action>*/}
+
+ <div className={styles['ItemContent']}>
+ <span
+ className={styles['Text']}
+ {...handleProps}
+ onClick={() => {
+ navigate(`/${workspace_id}/${pageId}`);
+ }}
+ >
+ {value}
+ </span>
+ {BooleanPageTreeItemMoreActions && (
+ <MoreActions
+ workspaceId={workspace_id}
+ pageId={pageId}
+ onRemove={onRemove}
+ />
+ )}
- {!clone && onRemove && <Remove onClick={onRemove} />}
- {clone && childCount && childCount > 1 ? (
- <span className={styles['Count']}>{childCount}</span>
- ) : null}
+ {/*{!clone && onRemove && <Remove onClick={onRemove} />}*/}
+ {clone && childCount && childCount > 1 ? (
+ <span className={styles['Count']}>
+ {childCount}
+ </span>
+ ) : null}
+ </div>
</div>
</li>
);
diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/tree-item.module.scss b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/tree-item.module.scss
index 74512207c8..7af3eda1c1 100755
--- a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/tree-item.module.scss
+++ b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/tree-item.module.scss
@@ -1,7 +1,6 @@
.Wrapper {
box-sizing: border-box;
padding-left: var(--spacing);
- margin-bottom: -1px;
list-style: none;
padding: 6px 0;
font-size: 14px;
@@ -68,12 +67,24 @@
.TreeItem {
box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ background-color: #fff;
+ color: #4c6275;
+}
+
+.ItemContent {
+ box-sizing: border-box;
+ width: 100%;
+ height: 32px;
position: relative;
display: flex;
align-items: center;
- padding: 4px 0;
+ justify-content: space-around;
background-color: #fff;
color: #4c6275;
+ padding: 0 0.5rem;
+ overflow: hidden;
.TreeItemMoreActions {
visibility: hidden;
@@ -85,11 +96,15 @@
display: block;
}
}
+
+ &:hover {
+ background: #f5f7f8;
+ border-radius: 5px;
+ }
}
.Text {
flex-grow: 1;
- padding-left: 0.5rem;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
@@ -98,13 +113,13 @@
.Count {
position: absolute;
- top: -10px;
- right: -10px;
+ top: 8px;
+ right: 0;
display: flex;
justify-content: center;
align-items: center;
- width: 24px;
- height: 24px;
+ width: 18px;
+ height: 18px;
border-radius: 50%;
background-color: #2389ff;
font-size: 0.9rem;
@@ -118,6 +133,7 @@
.disableSelection,
.clone {
+ width: 100%;
.Text,
.Count {
user-select: none;
diff --git a/libs/components/ui/src/index.ts b/libs/components/ui/src/index.ts
index 46769d4b9c..7d55074540 100644
--- a/libs/components/ui/src/index.ts
+++ b/libs/components/ui/src/index.ts
@@ -1,6 +1,6 @@
// Base abstract feature for all UI components
export { Theme, useTheme, withTheme, ThemeProvider } from './theme';
-export { styled } from './styled';
+export { styled, keyframes } from './styled';
export type { SxProps } from './styled';
export * from './mui';
diff --git a/libs/components/ui/src/styled/index.ts b/libs/components/ui/src/styled/index.ts
index f4f57597b8..9784a93951 100644
--- a/libs/components/ui/src/styled/index.ts
+++ b/libs/components/ui/src/styled/index.ts
@@ -1,5 +1,5 @@
// eslint-disable-next-line no-restricted-imports
-import { styled as muiStyled } from '@mui/material/styles';
+import { styled as muiStyled, keyframes } from '@mui/material/styles';
import { ReactHTML, ReactSVG } from 'react';
import isPropValid from '@emotion/is-prop-valid';
export type { SxProps } from '@mui/system';
@@ -71,3 +71,5 @@ export const styled: typeof muiStyled = (
options.shouldForwardProp = isValidProp;
return muiStyled(component, options);
};
+
+export { keyframes };