From da04b0f6bda679d57cb79e30adf6567eb5e571b3 Mon Sep 17 00:00:00 2001 From: XYShaoKang <38753204+XYShaoKang@users.noreply.github.com> Date: Wed, 8 Feb 2023 17:45:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(ranking):=20=E9=BC=A0=E6=A0=87=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=A7=BB=E5=8A=A8=E5=88=B0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/content/components/ToolTip.tsx | 15 +++++++++++---- src/content/pages/ranking/Title.tsx | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/content/components/ToolTip.tsx b/src/content/components/ToolTip.tsx index 812fb62..d8f0d5e 100644 --- a/src/content/components/ToolTip.tsx +++ b/src/content/components/ToolTip.tsx @@ -19,6 +19,7 @@ export interface TooltipOwnerProps { icon?: ReactElement delay?: number children: React.ReactElement + keep?: boolean } export const ToolTip: StyledComponent = @@ -32,12 +33,16 @@ export const ToolTip: StyledComponent = arrow: arrowProp, icon, delay, + keep, children, ...props }: SCProps, ref: ForwardedRef ) { const [setHoverRef, hover] = useHover(delay ?? 100) + const [setPopperHoverRef, popperHover] = useHover(delay ?? 100, [ + ref as any, + ]) const childrenRef = useRef() @@ -49,7 +54,7 @@ export const ToolTip: StyledComponent = let open = openProp if (openProp === undefined) { - open = !!(title && hover) + open = !!title && (hover || (keep && popperHover)) } let arrow = arrowProp if (arrowProp === undefined) { @@ -64,11 +69,13 @@ export const ToolTip: StyledComponent = placement={placement} anchorEl={childrenRef.current} {...props} - ref={ref} + ref={setPopperHoverRef} arrow={arrow} > - {icon} - {title} + <> + {icon} + {title} + ) : null} diff --git a/src/content/pages/ranking/Title.tsx b/src/content/pages/ranking/Title.tsx index 9ae5858..2ba17e0 100644 --- a/src/content/pages/ranking/Title.tsx +++ b/src/content/pages/ranking/Title.tsx @@ -31,6 +31,7 @@ const Help = () => { 预测数据来自