From 8d1da35b56a7fe397f23ca647212bf6c1a5f300c Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Tue, 9 Aug 2022 21:04:44 +0800 Subject: [PATCH] refactor: update component styles --- .../page-tree/tree-item/MoreActions.tsx | 28 ++-- .../page-tree/tree-item/TreeItem.tsx | 137 ++++-------------- 2 files changed, 44 insertions(+), 121 deletions(-) diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/MoreActions.tsx b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/MoreActions.tsx index f23e377f4a..1d211d9a31 100644 --- a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/MoreActions.tsx +++ b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/MoreActions.tsx @@ -1,20 +1,18 @@ -import styles from './tree-item.module.scss'; +import { AddIcon, MoreIcon } from '@toeverything/components/icons'; import { - MuiSnackbar as Snackbar, Cascader, CascaderItemProps, - MuiDivider as Divider, - MuiClickAwayListener as ClickAwayListener, IconButton, + MuiClickAwayListener as ClickAwayListener, + MuiSnackbar as Snackbar, styled, } from '@toeverything/components/ui'; -import React from 'react'; -import { NavLink, useNavigate } from 'react-router-dom'; -import { copyToClipboard } from '@toeverything/utils'; import { services, TemplateFactory } from '@toeverything/datasource/db-service'; -import { NewFromTemplatePortal } from './NewFromTemplatePortal'; import { useFlag } from '@toeverything/datasource/feature-flags'; -import { MoreIcon, AddIcon } from '@toeverything/components/icons'; +import { copyToClipboard } from '@toeverything/utils'; +import React from 'react'; +import { useNavigate } from 'react-router-dom'; +import { TreeItemMoreActions } from './styles'; const MESSAGES = { COPY_LINK_SUCCESS: 'Copyed link to clipboard', @@ -47,6 +45,10 @@ function DndTreeItemMoreActions(props: ActionsProps) { set_alert_open(false); }; const handleClick = (event: React.MouseEvent) => { + if (anchorEl) { + setAnchorEl(null); + return; + } setAnchorEl(event.currentTarget); }; const handleClose = () => { @@ -246,10 +248,11 @@ function DndTreeItemMoreActions(props: ActionsProps) { return ( handleClose()}>
-
+ @@ -262,14 +265,15 @@ function DndTreeItemMoreActions(props: ActionsProps) { -
+ + + /> ( 'BooleanPageTreeItemMoreActions', true ); - const theme = useTheme(); return ( -
  • -
    - + + {childCount !== 0 && (collapsed ? ( ) : ( ))} - + -
    - + {value} - + {BooleanPageTreeItemMoreActions && ( ( {/*{!clone && onRemove && }*/} {clone && childCount && childCount > 1 ? ( - - {childCount} - + {childCount} ) : null} -
    -
    -
  • + + + ); } ); - -export interface ActionProps extends React.HTMLAttributes { - active?: { - fill: string; - background: string; - }; - // cursor?: CSSProperties['cursor']; - cursor?: 'pointer' | 'grab'; -} - -/** Customizable buttons */ -export function Action({ - active, - className, - cursor, - style, - ...props -}: ActionProps) { - return ( -