Skip to content

Commit bd8254c

Browse files
committed
Fix tooltip crashes
1 parent 6337a7b commit bd8254c

File tree

4 files changed

+14
-21
lines changed

4 files changed

+14
-21
lines changed

packages/app/src/app/pages/Sandbox/Editor/Header/Action/index.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22

33
import MoreInfoIcon from 'react-icons/lib/md/arrow-drop-down';
4+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
45

56
import {
67
Title,
@@ -52,18 +53,16 @@ function ActionComponent({
5253
}: Props) {
5354
if (!href && (placeholder || tooltip)) {
5455
return (
55-
<ActionTooltip
56-
content={placeholder || tooltip}
57-
hideOnClick={false}
58-
{...props}
59-
>
60-
<IconContainer onClick={onClick} {...iconContainerProps}>
61-
<Icon {...iconProps} />
62-
{title !== undefined && <Title>{title}</Title>}
63-
{moreInfo && <MoreInfoIcon style={{ fontSize: '1.1rem' }} />}
64-
</IconContainer>
65-
{children}
66-
</ActionTooltip>
56+
<Action {...props}>
57+
<Tooltip content={placeholder || tooltip} hideOnClick={false}>
58+
<IconContainer onClick={onClick} {...iconContainerProps}>
59+
<Icon {...iconProps} />
60+
{title !== undefined && <Title>{title}</Title>}
61+
{moreInfo && <MoreInfoIcon style={{ fontSize: '1.1rem' }} />}
62+
</IconContainer>
63+
{children}
64+
</Tooltip>
65+
</Action>
6766
);
6867
}
6968
if (onClick) {

packages/common/src/components/Preview/Navigator/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import React from 'react';
32

43
import LeftIcon from 'react-icons/lib/fa/angle-left';
@@ -82,7 +81,7 @@ function Navigator({
8281
<Tooltip
8382
delay={0}
8483
content={isProjectView ? 'Project View' : 'Current Module View'}
85-
position="left"
84+
placement="left"
8685
>
8786
<Switch
8887
offMode
@@ -98,4 +97,4 @@ function Navigator({
9897
);
9998
}
10099

101-
export default Navigator
100+
export default Navigator;

packages/common/src/components/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const GlobalStyle = createGlobalStyle`
2222
const Tooltip = ({ children, style = {}, ...props }) => (
2323
<React.Fragment>
2424
<GlobalStyle />
25-
<Tippy {...props}>
25+
<Tippy delay={[500, 0]} {...props}>
2626
<span
2727
style={{
2828
...style,

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23867,11 +23867,6 @@ typescript@^3.3.1:
2386723867
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b"
2386823868
integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA==
2386923869

23870-
typescript@^3.3.4000:
23871-
version "3.3.4000"
23872-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.4000.tgz#76b0f89cfdbf97827e1112d64f283f1151d6adf0"
23873-
integrity sha512-jjOcCZvpkl2+z7JFn0yBOoLQyLoIkNZAs/fYJkUG6VKy6zLPHJGfQJYFHzibB6GJaF/8QrcECtlQ5cpvRHSMEA==
23874-
2387523870
typography-breakpoint-constants@^0.15.10:
2387623871
version "0.15.10"
2387723872
resolved "https://registry.yarnpkg.com/typography-breakpoint-constants/-/typography-breakpoint-constants-0.15.10.tgz#bd5308dd57250e7f28a8c6e1c0e668ddf1178c5c"

0 commit comments

Comments
 (0)