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.

fix(sidebar): use a tag for link

austaras07e6e9fe981f
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 96c14522fc..5274f48f55 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
@@ -3,9 +3,9 @@ import React, {
type CSSProperties,
type HTMLAttributes,
} from 'react';
-import { useParams, useNavigate } from 'react-router-dom';
+import { useParams, Link } from 'react-router-dom';
import cx from 'clsx';
-import { CloseIcon, DocumentIcon } from '@toeverything/components/common';
+import { CloseIcon } from '@toeverything/components/common';
import {
ArrowDropDownIcon,
ArrowRightIcon,
@@ -62,7 +62,6 @@ export const TreeItem = forwardRef<HTMLDivElement, TreeItemProps>(
ref
) => {
const { workspace_id } = useParams();
- const navigate = useNavigate();
const BooleanPageTreeItemMoreActions = useFlag(
'BooleanPageTreeItemMoreActions',
true
@@ -103,15 +102,13 @@ export const TreeItem = forwardRef<HTMLDivElement, TreeItemProps>(
</Action>
<div className={styles['ItemContent']}>
- <span
+ <Link
className={styles['Text']}
{...handleProps}
- onClick={() => {
- navigate(`/${workspace_id}/${pageId}`);
- }}
+ to={`/${workspace_id}/${pageId}`}
>
{value}
- </span>
+ </Link>
{BooleanPageTreeItemMoreActions && (
<MoreActions
workspaceId={workspace_id}
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 39ff90c59e..315a272366 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
@@ -105,6 +105,9 @@
text-overflow: ellipsis;
overflow: hidden;
cursor: pointer;
+ appearance: none;
+ color: unset;
+ text-decoration: none;
}
.Count {