Skip to content

Commit 9fda735

Browse files
SaraVieiraCompuIves
authored andcommitted
Switch from react-tippy to @tippy.js/react for tooltips (codesandbox#1584)
* chnage to @tippy.js/react * remove uneeded deps * remove old api * remove old api * fix props * small patreon fix * fix ts * fix alignment * fix build * Update path to common
1 parent c6758b2 commit 9fda735

File tree

44 files changed

+144
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+144
-132
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
"gulp": "^3.9.1",
7676
"lerna": "^2.5.1",
7777
"lint-staged": "^5.0.0",
78-
"prettier": "^1.8.2"
78+
"prettier": "^1.8.2",
79+
"typescript": "^3.3.1"
7980
},
8081
"dependencies": {
8182
"opencollective": "^1.0.3"

packages/app/src/app/components/CodeEditor/Configuration/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default class Configuration extends React.PureComponent<Props>
100100
/>
101101
<Title>{config.title}</Title>
102102

103-
<Tooltip title="Show Code">
103+
<Tooltip content="Show Code">
104104
<Icon onClick={this.props.toggleConfigUI}>
105105
<CodeIcon />
106106
</Icon>

packages/app/src/app/components/CodeEditor/FilePath/elements.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import styled from 'styled-components';
22
import ChevronLeft from 'react-icons/lib/md/chevron-left';
33
import ExitZen from 'react-icons/lib/md/fullscreen-exit';
4-
import { withTooltip } from '@codesandbox/common/lib/components/Tooltip';
54

65
export const Container = styled.div`
76
background-color: rgba(0, 0, 0, 0.3);
@@ -43,19 +42,16 @@ export const FileName = styled.div`
4342
flex: 1;
4443
`;
4544

46-
export const StyledExitZen = withTooltip(
47-
styled(ExitZen)`
48-
transition: 0.3s ease opacity;
45+
export const StyledExitZen = styled(ExitZen)`
46+
transition: 0.3s ease opacity;
4947
50-
cursor: pointer;
51-
font-size: 1.25rem;
48+
cursor: pointer;
49+
font-size: 1.25rem;
5250
53-
z-index: 10;
54-
opacity: 0.7;
51+
z-index: 10;
52+
opacity: 0.7;
5553
56-
&:hover {
57-
opacity: 1;
58-
}
59-
`,
60-
{ title: 'Close Zen Mode', style: { zIndex: 10 } }
61-
);
54+
&:hover {
55+
opacity: 1;
56+
}
57+
`;

packages/app/src/app/components/CodeEditor/FilePath/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22
import { getModulePath } from '@codesandbox/common/lib/sandbox/modules';
3+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
34
import EntryIcons from 'app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons';
45
import getType from 'app/utils/get-type';
56

@@ -60,7 +61,9 @@ export default class FilePath extends React.Component {
6061
</span>
6162
</FileName>
6263

63-
<StyledExitZen onClick={exitZenMode} />
64+
<Tooltip content="Close Zen Mode" style={{ zIndex: 10 }}>
65+
<StyledExitZen onClick={exitZenMode} />
66+
</Tooltip>
6467
</Container>
6568
);
6669
}

packages/app/src/app/components/CodeEditor/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export default class CodeEditor extends React.PureComponent<
195195
{config &&
196196
(getUI(config.type) && !settings.experimentVSCode ? (
197197
<Icons>
198-
<Tooltip title="Switch to UI Configuration">
198+
<Tooltip content="Switch to UI Configuration">
199199
<Icon onClick={this.toggleConfigUI}>
200200
<UIIcon />
201201
</Icon>
@@ -210,11 +210,11 @@ export default class CodeEditor extends React.PureComponent<
210210
>
211211
{config.partialSupportDisclaimer ? (
212212
<Tooltip
213-
position="bottom"
214-
title={config.partialSupportDisclaimer}
213+
placement="bottom"
214+
content={config.partialSupportDisclaimer}
215215
style={{
216216
display: 'flex',
217-
alignItems: 'center',
217+
'align-items': 'center',
218218
}}
219219
>
220220
Partially Supported Config{' '}

packages/app/src/app/components/DeleteSandboxButton/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import DeleteIcon from 'react-icons/lib/md/delete';
44
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
55

66
export const DeleteSandboxButton = styled(props => (
7-
<Tooltip title="Delete Sandbox">
7+
<Tooltip content="Delete Sandbox">
88
<button {...props}>
99
<DeleteIcon />
1010
</button>

packages/app/src/app/components/Integration/DetailInfo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function DetailInfo({ heading, info, signOut, signIn }) {
1515
</Margin>
1616

1717
{signOut ? (
18-
<Tooltip title="Sign out">
18+
<Tooltip content="Sign out">
1919
<Action onClick={signOut} red>
2020
<CrossIcon />
2121
</Action>

packages/app/src/app/components/Preview/DevTools/Problems/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Problems extends React.PureComponent<DevToolProps, State> {
106106
<Path>{splittedPath.join('/')}/</Path>
107107
<FileName>{fileName}</FileName>
108108
<Actions>
109-
<Tooltip title="Open File">
109+
<Tooltip content="Open File">
110110
<FileIcon onClick={() => this.openFile(file)} />
111111
</Tooltip>
112112
</Actions>

packages/app/src/app/components/Preview/DevTools/Tabs/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const DevToolTabs = ({
8585
{actions.map(({ title, onClick, Icon }) => (
8686
<Tooltip
8787
style={{ pointerEvents: hidden ? 'none' : 'initial' }}
88-
title={title}
88+
content={title}
8989
key={title}
9090
>
9191
<Icon

packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default ({ test, openFile }: Props) => (
2020
<TestName test={test} />
2121
<Actions>
2222
{openFile && (
23-
<Tooltip title="Open File">
23+
<Tooltip content="Open File">
2424
<FileIcon onClick={() => openFile(test.path)} />
2525
</Tooltip>
2626
)}

0 commit comments

Comments
 (0)