From 1e87707b2e2b2b383275f0586e7f3c245942e7c3 Mon Sep 17 00:00:00 2001 From: Qi <474021214@qq.com> Date: Mon, 28 Aug 2023 14:15:12 +0800 Subject: [PATCH] feat: replace tooltip with new design (#3969) --- apps/core/package.json | 2 +- apps/core/src/bootstrap/plugins/setup.ts | 3 ++ .../affine/create-workspace-modal/index.tsx | 11 ++-- .../new-workspace-setting-detail/publish.tsx | 8 ++- .../new-workspace-setting-detail/storage.tsx | 7 +-- .../setting-modal/setting-sidebar/index.tsx | 15 +++--- .../block-suite-mode-switch/index.tsx | 17 +++++-- .../src/components/pure/help-island/index.tsx | 30 +++-------- apps/storybook/src/stories/card.stories.tsx | 3 +- .../app-sidebar/app-updater-button/index.tsx | 4 +- .../sidebar-header/sidebar-switch.tsx | 11 ++-- .../src/components/import-page/index.tsx | 3 +- .../page-list/components/favorite-tag.tsx | 8 +-- .../components/page-list/operation-cell.tsx | 7 +-- .../page-list/view/collection-bar.tsx | 12 ++--- .../page-list/view/collection-list.tsx | 13 +++-- packages/component/src/index.ts | 1 - packages/component/src/ui/tooltip/index.tsx | 1 - packages/component/src/ui/tooltip/tooltip.tsx | 40 --------------- plugins/copilot/package.json | 2 +- plugins/copilot/src/UI/header-item.tsx | 4 +- plugins/hello-world/package.json | 2 +- plugins/hello-world/src/app.tsx | 2 +- plugins/image-preview/package.json | 2 +- plugins/image-preview/src/component/index.tsx | 24 ++++----- plugins/outline/package.json | 2 +- plugins/outline/src/app.tsx | 2 +- yarn.lock | 50 +++++++++++++++---- 28 files changed, 138 insertions(+), 148 deletions(-) delete mode 100644 packages/component/src/ui/tooltip/index.tsx delete mode 100644 packages/component/src/ui/tooltip/tooltip.tsx diff --git a/apps/core/package.json b/apps/core/package.json index 59767f2eb5..a9ae719ed7 100644 --- a/apps/core/package.json +++ b/apps/core/package.json @@ -39,7 +39,7 @@ "@emotion/styled": "^11.11.0", "@mui/material": "^5.14.6", "@react-hookz/web": "^23.1.0", - "@toeverything/components": "^0.0.17", + "@toeverything/components": "^0.0.19", "async-call-rpc": "^6.3.1", "cmdk": "^0.2.0", "css-spring": "^4.1.0", diff --git a/apps/core/src/bootstrap/plugins/setup.ts b/apps/core/src/bootstrap/plugins/setup.ts index 7e42aeda6d..213f77541d 100644 --- a/apps/core/src/bootstrap/plugins/setup.ts +++ b/apps/core/src/bootstrap/plugins/setup.ts @@ -158,6 +158,9 @@ function createSetupImpl(rootStore: ReturnType) { '@toeverything/components/button': import( '@toeverything/components/button' ), + '@toeverything/components/tooltip': import( + '@toeverything/components/tooltip' + ), }); // pluginName -> module -> importName -> updater[] diff --git a/apps/core/src/components/affine/create-workspace-modal/index.tsx b/apps/core/src/components/affine/create-workspace-modal/index.tsx index d40da0922f..806050da45 100644 --- a/apps/core/src/components/affine/create-workspace-modal/index.tsx +++ b/apps/core/src/components/affine/create-workspace-modal/index.tsx @@ -4,19 +4,19 @@ import { ModalCloseButton, ModalWrapper, toast, - Tooltip, } from '@affine/component'; import { DebugLogger } from '@affine/debug'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { HelpIcon } from '@blocksuite/icons'; import { Button } from '@toeverything/components/button'; +import { Tooltip } from '@toeverything/components/tooltip'; import type { LoadDBFileResult, SelectDBFileLocationResult, } from '@toeverything/infra/type'; import { useSetAtom } from 'jotai'; import type { KeyboardEvent } from 'react'; -import { useEffect } from 'react'; +import { useEffect, useRef } from 'react'; import { useLayoutEffect } from 'react'; import { useCallback, useState } from 'react'; @@ -125,6 +125,7 @@ const SetDBLocationContent = ({ onConfirmLocation, }: SetDBLocationContentProps) => { const t = useAFFiNEI18N(); + const ref = useRef(null); const defaultDBLocation = useDefaultDBLocation(); const [opening, setOpening] = useState(false); @@ -161,11 +162,12 @@ const SetDBLocationContent = ({ {t['Customize']()} diff --git a/apps/core/src/components/affine/new-workspace-setting-detail/publish.tsx b/apps/core/src/components/affine/new-workspace-setting-detail/publish.tsx index 4420c6f542..7aebc3c076 100644 --- a/apps/core/src/components/affine/new-workspace-setting-detail/publish.tsx +++ b/apps/core/src/components/affine/new-workspace-setting-detail/publish.tsx @@ -1,4 +1,4 @@ -import { FlexWrapper, Switch, Tooltip } from '@affine/component'; +import { FlexWrapper, Switch } from '@affine/component'; import { SettingRow } from '@affine/component/setting-components'; import { Unreachable } from '@affine/env/constant'; import type { @@ -8,6 +8,7 @@ import type { import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { Button } from '@toeverything/components/button'; +import { Tooltip } from '@toeverything/components/tooltip'; import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name'; import { useCallback, useEffect, useState } from 'react'; @@ -93,10 +94,7 @@ const FakePublishPanelAffine = (_props: FakePublishPanelAffineProps) => { const t = useAFFiNEI18N(); return ( - +
diff --git a/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx b/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx index 9615902402..c2063949c7 100644 --- a/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx +++ b/apps/core/src/components/affine/new-workspace-setting-detail/storage.tsx @@ -1,7 +1,8 @@ -import { FlexWrapper, toast, Tooltip } from '@affine/component'; +import { FlexWrapper, toast } from '@affine/component'; import { SettingRow } from '@affine/component/setting-components'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { Button } from '@toeverything/components/button'; +import { Tooltip } from '@toeverything/components/tooltip'; import type { MoveDBFileResult } from '@toeverything/infra/type'; import { useMemo } from 'react'; import { useCallback, useEffect, useState } from 'react'; @@ -75,9 +76,9 @@ export const StoragePanel = ({ workspace }: StoragePanelProps) => { secondaryPath ? (