mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-23 13:29:02 +08:00
feat: add novice guide for quick search arrow button (#1493)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
import { atom } from 'jotai';
|
||||||
|
import { atomWithStorage } from 'jotai/utils';
|
||||||
|
|
||||||
|
export const isFirstLoadAtom = atomWithStorage<boolean>('isFirstLoad', true);
|
||||||
|
export const openTipsAtom = atom<boolean>(false);
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
import { Tooltip } from '@affine/component';
|
import { Tooltip } from '@affine/component';
|
||||||
import { useTranslation } from '@affine/i18n';
|
import { useTranslation } from '@affine/i18n';
|
||||||
import React, { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
useIsFirstLoad,
|
||||||
|
useOpenTips,
|
||||||
|
} from '../../../hooks/affine/use-is-first-load';
|
||||||
import { useSidebarStatus } from '../../../hooks/affine/use-sidebar-status';
|
import { useSidebarStatus } from '../../../hooks/affine/use-sidebar-status';
|
||||||
import { SidebarSwitchIcon } from './icons';
|
import { SidebarSwitchIcon } from './icons';
|
||||||
import { StyledSidebarSwitch } from './style';
|
import { StyledSidebarSwitch } from './style';
|
||||||
@@ -17,6 +21,8 @@ export const SidebarSwitch = ({
|
|||||||
}: SidebarSwitchProps) => {
|
}: SidebarSwitchProps) => {
|
||||||
const [open, setOpen] = useSidebarStatus();
|
const [open, setOpen] = useSidebarStatus();
|
||||||
const [tooltipVisible, setTooltipVisible] = useState(false);
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
||||||
|
const [isFirstLoad, setIsFirstLoad] = useIsFirstLoad();
|
||||||
|
const [, setOpenTips] = useOpenTips();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
tooltipContent =
|
tooltipContent =
|
||||||
tooltipContent || (open ? t('Collapse sidebar') : t('Expand sidebar'));
|
tooltipContent || (open ? t('Collapse sidebar') : t('Expand sidebar'));
|
||||||
@@ -34,7 +40,13 @@ export const SidebarSwitch = ({
|
|||||||
onClick={useCallback(() => {
|
onClick={useCallback(() => {
|
||||||
setOpen(!open);
|
setOpen(!open);
|
||||||
setTooltipVisible(false);
|
setTooltipVisible(false);
|
||||||
}, [open, setOpen])}
|
if (isFirstLoad) {
|
||||||
|
setIsFirstLoad(false);
|
||||||
|
setTimeout(() => {
|
||||||
|
setOpenTips(true);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
}, [isFirstLoad, open, setIsFirstLoad, setOpen, setOpenTips])}
|
||||||
onMouseEnter={useCallback(() => {
|
onMouseEnter={useCallback(() => {
|
||||||
setTooltipVisible(true);
|
setTooltipVisible(true);
|
||||||
}, [])}
|
}, [])}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { Content } from '@affine/component';
|
import { Content, QuickSearchTips } from '@affine/component';
|
||||||
|
import { getEnvironment } from '@affine/env';
|
||||||
|
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
||||||
import { assertExists } from '@blocksuite/store';
|
import { assertExists } from '@blocksuite/store';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { openQuickSearchModalAtom } from '../../../atoms';
|
import { openQuickSearchModalAtom } from '../../../atoms';
|
||||||
|
import { useOpenTips } from '../../../hooks/affine/use-is-first-load';
|
||||||
import { usePageMeta } from '../../../hooks/use-page-meta';
|
import { usePageMeta } from '../../../hooks/use-page-meta';
|
||||||
import { BlockSuiteWorkspace } from '../../../shared';
|
import { BlockSuiteWorkspace } from '../../../shared';
|
||||||
import { PageNotFoundError } from '../../affine/affine-error-eoundary';
|
import { PageNotFoundError } from '../../affine/affine-error-eoundary';
|
||||||
@@ -11,6 +14,8 @@ import { EditorModeSwitch } from './editor-mode-switch';
|
|||||||
import Header from './header';
|
import Header from './header';
|
||||||
import { QuickSearchButton } from './quick-search-button';
|
import { QuickSearchButton } from './quick-search-button';
|
||||||
import {
|
import {
|
||||||
|
StyledQuickSearchTipButton,
|
||||||
|
StyledQuickSearchTipContent,
|
||||||
StyledSearchArrowWrapper,
|
StyledSearchArrowWrapper,
|
||||||
StyledSwitchWrapper,
|
StyledSwitchWrapper,
|
||||||
StyledTitle,
|
StyledTitle,
|
||||||
@@ -43,6 +48,39 @@ export const BlockSuiteEditorHeader: React.FC<BlockSuiteEditorHeaderProps> = ({
|
|||||||
assertExists(pageMeta);
|
assertExists(pageMeta);
|
||||||
const title = pageMeta.title;
|
const title = pageMeta.title;
|
||||||
const { trash: isTrash } = pageMeta;
|
const { trash: isTrash } = pageMeta;
|
||||||
|
const [openTips, setOpenTips] = useOpenTips();
|
||||||
|
const isMac = () => {
|
||||||
|
const env = getEnvironment();
|
||||||
|
return env.isBrowser && env.isMacOs;
|
||||||
|
};
|
||||||
|
const tipsContent = () => {
|
||||||
|
return (
|
||||||
|
<StyledQuickSearchTipContent>
|
||||||
|
<div>
|
||||||
|
Click button
|
||||||
|
{
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
fontSize: '24px',
|
||||||
|
verticalAlign: 'middle',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowDownSmallIcon />
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
or use
|
||||||
|
{isMac() ? ' ⌘ + K' : ' Ctrl + K'} to activate Quick Search. Then you
|
||||||
|
can search keywords or quickly open recently viewed pages.
|
||||||
|
</div>
|
||||||
|
<StyledQuickSearchTipButton
|
||||||
|
data-testid="quick-search-got-it"
|
||||||
|
onClick={() => setOpenTips(false)}
|
||||||
|
>
|
||||||
|
Got it
|
||||||
|
</StyledQuickSearchTipButton>
|
||||||
|
</StyledQuickSearchTipContent>
|
||||||
|
);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Header
|
<Header
|
||||||
rightItems={
|
rightItems={
|
||||||
@@ -68,13 +106,21 @@ export const BlockSuiteEditorHeader: React.FC<BlockSuiteEditorHeaderProps> = ({
|
|||||||
/>
|
/>
|
||||||
</StyledSwitchWrapper>
|
</StyledSwitchWrapper>
|
||||||
<Content ellipsis={true}>{title || 'Untitled'}</Content>
|
<Content ellipsis={true}>{title || 'Untitled'}</Content>
|
||||||
<StyledSearchArrowWrapper>
|
<QuickSearchTips
|
||||||
<QuickSearchButton
|
data-testid="quick-search-tips"
|
||||||
onClick={() => {
|
content={tipsContent()}
|
||||||
setOpenQuickSearch(true);
|
placement="bottom"
|
||||||
}}
|
open={openTips}
|
||||||
/>
|
offset={[0, -5]}
|
||||||
</StyledSearchArrowWrapper>
|
>
|
||||||
|
<StyledSearchArrowWrapper>
|
||||||
|
<QuickSearchButton
|
||||||
|
onClick={() => {
|
||||||
|
setOpenQuickSearch(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</StyledSearchArrowWrapper>
|
||||||
|
</QuickSearchTips>
|
||||||
</StyledTitleWrapper>
|
</StyledTitleWrapper>
|
||||||
</StyledTitle>
|
</StyledTitle>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { IconButton, IconButtonProps } from '@affine/component';
|
import { IconButton, IconButtonProps } from '@affine/component';
|
||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
const StyledIconButtonWithAnimate = styled(IconButton)(({ theme }) => {
|
const StyledIconButtonWithAnimate = styled(IconButton)(({ theme }) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -113,3 +113,24 @@ export const StyledPageListTittleWrapper = styled(StyledTitle)(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
export const StyledQuickSearchTipButton = styled('div')(({ theme }) => {
|
||||||
|
return {
|
||||||
|
...displayFlex('center', 'center'),
|
||||||
|
marginTop: '12px',
|
||||||
|
color: '#FFFFFF',
|
||||||
|
width: '60px',
|
||||||
|
height: ' 26px',
|
||||||
|
fontSize: theme.font.sm,
|
||||||
|
lineHeight: '22px',
|
||||||
|
background: theme.colors.primaryColor,
|
||||||
|
borderRadius: '8px',
|
||||||
|
textAlign: 'center',
|
||||||
|
cursor: 'pointer',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
export const StyledQuickSearchTipContent = styled('div')(({ theme }) => {
|
||||||
|
return {
|
||||||
|
...displayFlex('center', 'flex-end'),
|
||||||
|
flexDirection: 'column',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ export const QuickSearchModal: React.FC<QuickSearchModalProps> = ({
|
|||||||
width={620}
|
width={620}
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '80vh',
|
maxHeight: '80vh',
|
||||||
minHeight: isPublicAndNoQuery() ? '72px' : '350px',
|
minHeight: isPublicAndNoQuery() ? '72px' : '412px',
|
||||||
top: '12vh',
|
top: '80px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Command
|
<Command
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { displayFlex, styled } from '@affine/component';
|
|||||||
|
|
||||||
export const StyledContent = styled('div')(({ theme }) => {
|
export const StyledContent = styled('div')(({ theme }) => {
|
||||||
return {
|
return {
|
||||||
minHeight: '220px',
|
minHeight: '280px',
|
||||||
maxHeight: '55vh',
|
maxHeight: '70vh',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
marginBottom: '10px',
|
marginBottom: '10px',
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ export const WorkSpaceSliderBar: React.FC<WorkSpaceSliderBarProps> = ({
|
|||||||
testid="sliderBar-arrowButton-collapse"
|
testid="sliderBar-arrowButton-collapse"
|
||||||
/>
|
/>
|
||||||
</StyledSidebarWrapper>
|
</StyledSidebarWrapper>
|
||||||
|
|
||||||
<StyledSliderBarWrapper data-testid="sliderBar">
|
<StyledSliderBarWrapper data-testid="sliderBar">
|
||||||
<WorkspaceSelector
|
<WorkspaceSelector
|
||||||
currentWorkspace={currentWorkspace}
|
currentWorkspace={currentWorkspace}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
LocalWorkspace,
|
LocalWorkspace,
|
||||||
RemWorkspaceFlavour,
|
RemWorkspaceFlavour,
|
||||||
} from '../../shared';
|
} from '../../shared';
|
||||||
|
import { useIsFirstLoad, useOpenTips } from '../affine/use-is-first-load';
|
||||||
import {
|
import {
|
||||||
useRecentlyViewed,
|
useRecentlyViewed,
|
||||||
useSyncRecentViewsWithRouter,
|
useSyncRecentViewsWithRouter,
|
||||||
@@ -314,3 +315,21 @@ describe('useRecentlyViewed', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe('useIsFirstLoad', () => {
|
||||||
|
test('basic', async () => {
|
||||||
|
const firstLoad = renderHook(() => useIsFirstLoad());
|
||||||
|
const setFirstLoad = firstLoad.result.current[1];
|
||||||
|
expect(firstLoad.result.current[0]).toEqual(true);
|
||||||
|
setFirstLoad(false);
|
||||||
|
firstLoad.rerender();
|
||||||
|
expect(firstLoad.result.current[0]).toEqual(false);
|
||||||
|
});
|
||||||
|
test('useOpenTips', async () => {
|
||||||
|
const openTips = renderHook(() => useOpenTips());
|
||||||
|
const setOpenTips = openTips.result.current[1];
|
||||||
|
expect(openTips.result.current[0]).toEqual(false);
|
||||||
|
setOpenTips(true);
|
||||||
|
openTips.rerender();
|
||||||
|
expect(openTips.result.current[0]).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { useAtom } from 'jotai';
|
||||||
|
|
||||||
|
import { isFirstLoadAtom, openTipsAtom } from '../../atoms/first-load';
|
||||||
|
|
||||||
|
export function useIsFirstLoad() {
|
||||||
|
const [isFirstLoad, setIsFirstLoad] = useAtom(isFirstLoadAtom);
|
||||||
|
return [isFirstLoad, setIsFirstLoad] as const;
|
||||||
|
}
|
||||||
|
export function useOpenTips() {
|
||||||
|
const [openTips, setOpenTips] = useAtom(openTipsAtom);
|
||||||
|
return [openTips, setOpenTips] as const;
|
||||||
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
# Welcome to AFFiNE
|
# Welcome to AFFiNE
|
||||||
|
|
||||||
👋 Quick Start
|
# 👋 Quick Start
|
||||||
==============
|
|
||||||
|
|
||||||
> Your content should be as feature-rich as you like. We offer you an easy and simple approach to writing your content, with advanced tools that stay out of the way when you don't need them.
|
> Your content should be as feature-rich as you like. We offer you an easy and simple approach to writing your content, with advanced tools that stay out of the way when you don't need them.
|
||||||
|
|
||||||
AFFiNE - not just a note taking app
|
## AFFiNE - not just a note taking app
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
There are lots of apps out there, so why choose AFFiNE?
|
There are lots of apps out there, so why choose AFFiNE?
|
||||||
|
|
||||||
@@ -18,18 +16,16 @@ AFFiNE is **privacy focused** - with a local-first approach, keep control of you
|
|||||||
|
|
||||||
AFFiNE is **open source** - you can check us out on [GitHub: toeverything/AFFiNE](https://github.com/toeverything/affine)
|
AFFiNE is **open source** - you can check us out on [GitHub: toeverything/AFFiNE](https://github.com/toeverything/affine)
|
||||||
|
|
||||||
Let's get started!
|
## Let's get started!
|
||||||
------------------
|
|
||||||
|
|
||||||
* Create a new page and begin editing - in `Paper` or `Edgeless`
|
- Create a new page and begin editing - in `Paper` or `Edgeless`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
* Head over to `Workspace Settings` to find your `General` settings, enable multiplayer with `Collaboration`, share your docs with `Publish` and download your data with `Export`
|
- Head over to `Workspace Settings` to find your `General` settings, enable multiplayer with `Collaboration`, share your docs with `Publish` and download your data with `Export`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Looking for more support?
|
## Looking for more support?
|
||||||
-------------
|
|
||||||
|
|
||||||
Why not come and join the awesome [AFFiNE Community](https://community.affine.pro)? Whether you want to share new ideas or interact with other like minded individuals - we look forward to having you.
|
Why not come and join the awesome [AFFiNE Community](https://community.affine.pro)? Whether you want to share new ideas or interact with other like minded individuals - we look forward to having you.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { forwardRef } from 'react';
|
import { CSSProperties, forwardRef } from 'react';
|
||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { PopperArrowProps } from './interface';
|
import { PopperArrowProps } from './interface';
|
||||||
@@ -9,7 +9,10 @@ export const PopperArrow = forwardRef<HTMLElement, PopperArrowProps>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const getArrowStyle = (placement: PopperArrowProps['placement']) => {
|
const getArrowStyle = (
|
||||||
|
placement: PopperArrowProps['placement'],
|
||||||
|
backgroundColor: CSSProperties['backgroundColor']
|
||||||
|
) => {
|
||||||
if (placement.indexOf('bottom') === 0) {
|
if (placement.indexOf('bottom') === 0) {
|
||||||
return {
|
return {
|
||||||
top: 0,
|
top: 0,
|
||||||
@@ -19,7 +22,7 @@ const getArrowStyle = (placement: PopperArrowProps['placement']) => {
|
|||||||
height: '1em',
|
height: '1em',
|
||||||
'&::before': {
|
'&::before': {
|
||||||
borderWidth: '0 1em 1em 1em',
|
borderWidth: '0 1em 1em 1em',
|
||||||
borderColor: `transparent transparent #98ACBD transparent`,
|
borderColor: `transparent transparent ${backgroundColor} transparent`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -33,7 +36,7 @@ const getArrowStyle = (placement: PopperArrowProps['placement']) => {
|
|||||||
height: '1em',
|
height: '1em',
|
||||||
'&::before': {
|
'&::before': {
|
||||||
borderWidth: '1em 1em 0 1em',
|
borderWidth: '1em 1em 0 1em',
|
||||||
borderColor: `#98ACBD transparent transparent transparent`,
|
borderColor: `${backgroundColor} transparent transparent transparent`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -45,7 +48,7 @@ const getArrowStyle = (placement: PopperArrowProps['placement']) => {
|
|||||||
width: '1em',
|
width: '1em',
|
||||||
'&::before': {
|
'&::before': {
|
||||||
borderWidth: '1em 0 1em 1em',
|
borderWidth: '1em 0 1em 1em',
|
||||||
borderColor: `transparent transparent transparent #98ACBD`,
|
borderColor: `transparent transparent transparent ${backgroundColor}`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -57,7 +60,7 @@ const getArrowStyle = (placement: PopperArrowProps['placement']) => {
|
|||||||
width: '1em',
|
width: '1em',
|
||||||
'&::before': {
|
'&::before': {
|
||||||
borderWidth: '1em 1em 1em 0',
|
borderWidth: '1em 1em 1em 0',
|
||||||
borderColor: `transparent #98ACBD transparent transparent`,
|
borderColor: `transparent ${backgroundColor} transparent transparent`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -69,7 +72,7 @@ const getArrowStyle = (placement: PopperArrowProps['placement']) => {
|
|||||||
|
|
||||||
const StyledArrow = styled('span')<{
|
const StyledArrow = styled('span')<{
|
||||||
placement: PopperArrowProps['placement'];
|
placement: PopperArrowProps['placement'];
|
||||||
}>(({ placement }) => {
|
}>(({ placement, theme }) => {
|
||||||
return {
|
return {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
fontSize: '7px',
|
fontSize: '7px',
|
||||||
@@ -88,6 +91,6 @@ const StyledArrow = styled('span')<{
|
|||||||
bottom: 0,
|
bottom: 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
...getArrowStyle(placement),
|
...getArrowStyle(placement, theme.colors.tooltipBackground),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import type { TooltipProps } from '@mui/material';
|
||||||
|
|
||||||
|
import { css, displayFlex, styled } from '../../styles';
|
||||||
|
import { Popper, type PopperProps } from '../popper';
|
||||||
|
import StyledPopperContainer from '../shared/Container';
|
||||||
|
const StyledTooltip = styled(StyledPopperContainer)(({ theme }) => {
|
||||||
|
return {
|
||||||
|
width: '390px',
|
||||||
|
minHeight: '92px',
|
||||||
|
boxShadow: theme.shadow.tooltip,
|
||||||
|
padding: '12px',
|
||||||
|
backgroundColor: theme.colors.hoverBackground,
|
||||||
|
transform: 'all 0.15s',
|
||||||
|
color: theme.colors.primaryColor,
|
||||||
|
...displayFlex('center', 'center'),
|
||||||
|
border: `1px solid ${theme.colors.primaryColor}`,
|
||||||
|
fontSize: theme.font.sm,
|
||||||
|
lineHeight: '22px',
|
||||||
|
fontWeight: 500,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const StyledCircleContainer = styled('div')(({ theme }) => {
|
||||||
|
return css`
|
||||||
|
position: relative;
|
||||||
|
content: '';
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(0%, 0%);
|
||||||
|
width: 0;
|
||||||
|
height: 40px;
|
||||||
|
border-right: 1px solid ${theme.colors.primaryColor};
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -100%);
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid ${theme.colors.primaryColor};
|
||||||
|
}
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -150%);
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: ${theme.colors.primaryColor};
|
||||||
|
border: 1px solid ${theme.colors.primaryColor};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
export const QuickSearchTips = (
|
||||||
|
props: PopperProps & Omit<TooltipProps, 'title'>
|
||||||
|
) => {
|
||||||
|
const { content, placement = 'top', children } = props;
|
||||||
|
return (
|
||||||
|
<Popper
|
||||||
|
{...props}
|
||||||
|
content={
|
||||||
|
<div>
|
||||||
|
<StyledCircleContainer />
|
||||||
|
<StyledTooltip placement={placement}>{content}</StyledTooltip>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Popper>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -19,7 +19,6 @@ export const Tooltip = (props: PopperProps & Omit<TooltipProps, 'title'>) => {
|
|||||||
return (
|
return (
|
||||||
<Popper
|
<Popper
|
||||||
{...props}
|
{...props}
|
||||||
showArrow={false}
|
|
||||||
content={<StyledTooltip placement={placement}>{content}</StyledTooltip>}
|
content={<StyledTooltip placement={placement}>{content}</StyledTooltip>}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
|
export * from './QuickSearch-tips';
|
||||||
export * from './Tooltip';
|
export * from './Tooltip';
|
||||||
|
|||||||
@@ -150,3 +150,17 @@ test.describe('Focus event for quick search', () => {
|
|||||||
await titleIsFocused(page);
|
await titleIsFocused(page);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
test.describe('Novice guidance for quick search', () => {
|
||||||
|
test('When opening the website for the first time, the first folding sidebar will appear novice guide', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const quickSearchTips = page.locator('[data-testid=quick-search-tips]');
|
||||||
|
await expect(quickSearchTips).not.toBeVisible();
|
||||||
|
await page.getByTestId('sliderBar-arrowButton-collapse').click();
|
||||||
|
const sliderBarArea = page.getByTestId('sliderBar');
|
||||||
|
await expect(sliderBarArea).not.toBeVisible();
|
||||||
|
await expect(quickSearchTips).toBeVisible();
|
||||||
|
await page.locator('[data-testid=quick-search-got-it]').click();
|
||||||
|
await expect(quickSearchTips).not.toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user