fix(sidebar): use a tag for link

This commit is contained in:
austaras 2022-08-05 15:18:23 +08:00 committed by Austaras
parent ed941a02aa
commit 07e6e9fe98
2 changed files with 8 additions and 8 deletions

View File

@ -3,9 +3,9 @@ import React, {
type CSSProperties, type CSSProperties,
type HTMLAttributes, type HTMLAttributes,
} from 'react'; } from 'react';
import { useParams, useNavigate } from 'react-router-dom'; import { useParams, Link } from 'react-router-dom';
import cx from 'clsx'; import cx from 'clsx';
import { CloseIcon, DocumentIcon } from '@toeverything/components/common'; import { CloseIcon } from '@toeverything/components/common';
import { import {
ArrowDropDownIcon, ArrowDropDownIcon,
ArrowRightIcon, ArrowRightIcon,
@ -62,7 +62,6 @@ export const TreeItem = forwardRef<HTMLDivElement, TreeItemProps>(
ref ref
) => { ) => {
const { workspace_id } = useParams(); const { workspace_id } = useParams();
const navigate = useNavigate();
const BooleanPageTreeItemMoreActions = useFlag( const BooleanPageTreeItemMoreActions = useFlag(
'BooleanPageTreeItemMoreActions', 'BooleanPageTreeItemMoreActions',
true true
@ -103,15 +102,13 @@ export const TreeItem = forwardRef<HTMLDivElement, TreeItemProps>(
</Action> </Action>
<div className={styles['ItemContent']}> <div className={styles['ItemContent']}>
<span <Link
className={styles['Text']} className={styles['Text']}
{...handleProps} {...handleProps}
onClick={() => { to={`/${workspace_id}/${pageId}`}
navigate(`/${workspace_id}/${pageId}`);
}}
> >
{value} {value}
</span> </Link>
{BooleanPageTreeItemMoreActions && ( {BooleanPageTreeItemMoreActions && (
<MoreActions <MoreActions
workspaceId={workspace_id} workspaceId={workspace_id}

View File

@ -105,6 +105,9 @@
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
appearance: none;
color: unset;
text-decoration: none;
} }
.Count { .Count {