Skip to content

Commit 12de731

Browse files
Georgi2704pboers1988DutchBen
authored
2256 Fix tooltip visible after clicking (#2329)
* 2256 Fix tooltip visible after clicking * Update packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStep/WfoCodeViewSelector.tsx Co-authored-by: Ruben van Leeuwen <[email protected]> --------- Co-authored-by: Peter Boers <[email protected]> Co-authored-by: Ruben van Leeuwen <[email protected]>
1 parent 738ff82 commit 12de731

File tree

4 files changed

+42
-27
lines changed

4 files changed

+42
-27
lines changed

.changeset/pretty-beans-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@orchestrator-ui/orchestrator-ui-components': patch
3+
---
4+
5+
2256 Fix tooltip visible after clicking

packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStep/WfoCodeViewSelector.tsx

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from 'react';
1+
import React, { useCallback, useState } from 'react';
22

33
import { useTranslations } from 'next-intl';
44

@@ -27,22 +27,26 @@ export const WfoCodeViewSelector = ({
2727

2828
const isSelected = (buttonView: CodeView): boolean =>
2929
buttonView === codeView;
30+
const [showTooltips, setShowTooltips] = useState<boolean>(true);
3031

3132
const codeViewOptions = [
3233
{
3334
id: CodeView.JSON,
3435
label: t('codeView.json'),
36+
onMouseLeave: () => setShowTooltips(true),
3537
iconType: () => (
36-
<WfoBracketSquare
37-
color={
38-
isSelected(CodeView.JSON)
39-
? theme.colors.ghost
40-
: theme.colors.textPrimary
41-
}
42-
/>
38+
<div onClick={() => setShowTooltips(false)}>
39+
<WfoBracketSquare
40+
color={
41+
isSelected(CodeView.JSON)
42+
? theme.colors.ghost
43+
: theme.colors.textPrimary
44+
}
45+
/>
46+
</div>
4347
),
4448
'data-test-id': 'jsonCodeViewButton',
45-
toolTipContent: t('codeView.json'),
49+
toolTipContent: showTooltips ? t('codeView.json') : undefined,
4650
style: {
4751
backgroundColor: isSelected(CodeView.JSON)
4852
? theme.colors.textPrimary
@@ -52,17 +56,20 @@ export const WfoCodeViewSelector = ({
5256
{
5357
id: CodeView.TABLE,
5458
label: t('codeView.table'),
59+
onMouseLeave: () => setShowTooltips(true),
5560
iconType: () => (
56-
<WfoTableCells
57-
color={
58-
isSelected(CodeView.TABLE)
59-
? theme.colors.ghost
60-
: theme.colors.textPrimary
61-
}
62-
/>
61+
<div onClick={() => setShowTooltips(false)}>
62+
<WfoTableCells
63+
color={
64+
isSelected(CodeView.TABLE)
65+
? theme.colors.ghost
66+
: theme.colors.textPrimary
67+
}
68+
/>
69+
</div>
6370
),
6471
'data-test-id': 'tableCodeViewButton',
65-
toolTipContent: t('codeView.table'),
72+
toolTipContent: showTooltips ? t('codeView.table') : undefined,
6673
style: {
6774
backgroundColor: isSelected(CodeView.TABLE)
6875
? theme.colors.textPrimary
@@ -72,17 +79,20 @@ export const WfoCodeViewSelector = ({
7279
{
7380
id: CodeView.RAW,
7481
label: t('codeView.raw'),
82+
onMouseLeave: () => setShowTooltips(true),
7583
iconType: () => (
76-
<WfoCommandLine
77-
color={
78-
isSelected(CodeView.RAW)
79-
? theme.colors.ghost
80-
: theme.colors.textPrimary
81-
}
82-
/>
84+
<div onClick={() => setShowTooltips(false)}>
85+
<WfoCommandLine
86+
color={
87+
isSelected(CodeView.RAW)
88+
? theme.colors.ghost
89+
: theme.colors.textPrimary
90+
}
91+
/>
92+
</div>
8393
),
8494
'data-test-id': 'rawCodeViewButton',
85-
toolTipContent: t('codeView.raw'),
95+
toolTipContent: showTooltips ? t('codeView.raw') : undefined,
8696
style: {
8797
backgroundColor: isSelected(CodeView.RAW)
8898
? theme.colors.textPrimary

packages/orchestrator-ui-components/src/messages/en-GB.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
"traceback": "Traceback",
255255
"codeView": {
256256
"json": "JSON",
257-
"table": "Tab",
257+
"table": "Table",
258258
"raw": "Raw"
259259
}
260260
},

packages/orchestrator-ui-components/src/messages/nl-NL.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
"traceback": "Traceback",
252252
"codeView": {
253253
"json": "JSON",
254-
"table": "Tab",
254+
"table": "Table",
255255
"raw": "Raw"
256256
}
257257
},

0 commit comments

Comments
 (0)