Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/pretty-beans-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@orchestrator-ui/orchestrator-ui-components': patch
---

2256 Fix tooltip visible after clicking
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback } from 'react';
import React, { useCallback, useState } from 'react';

import { useTranslations } from 'next-intl';

Expand Down Expand Up @@ -27,22 +27,26 @@ export const WfoCodeViewSelector = ({

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

const codeViewOptions = [
{
id: CodeView.JSON,
label: t('codeView.json'),
onMouseLeave: () => setShowTooltips(true),
iconType: () => (
<WfoBracketSquare
color={
isSelected(CodeView.JSON)
? theme.colors.ghost
: theme.colors.textPrimary
}
/>
<div onClick={() => setShowTooltips(false)}>
<WfoBracketSquare
color={
isSelected(CodeView.JSON)
? theme.colors.ghost
: theme.colors.textPrimary
}
/>
</div>
),
'data-test-id': 'jsonCodeViewButton',
toolTipContent: t('codeView.json'),
toolTipContent: showTooltips ? t('codeView.json') : undefined,
style: {
backgroundColor: isSelected(CodeView.JSON)
? theme.colors.textPrimary
Expand All @@ -52,17 +56,20 @@ export const WfoCodeViewSelector = ({
{
id: CodeView.TABLE,
label: t('codeView.table'),
onMouseLeave: () => setShowTooltips(true),
iconType: () => (
<WfoTableCells
color={
isSelected(CodeView.TABLE)
? theme.colors.ghost
: theme.colors.textPrimary
}
/>
<div onClick={() => setShowTooltips(false)}>
<WfoTableCells
color={
isSelected(CodeView.TABLE)
? theme.colors.ghost
: theme.colors.textPrimary
}
/>
</div>
),
'data-test-id': 'tableCodeViewButton',
toolTipContent: t('codeView.table'),
toolTipContent: showTooltips ? t('codeView.table') : undefined,
style: {
backgroundColor: isSelected(CodeView.TABLE)
? theme.colors.textPrimary
Expand All @@ -72,17 +79,20 @@ export const WfoCodeViewSelector = ({
{
id: CodeView.RAW,
label: t('codeView.raw'),
onMouseLeave: () => setShowTooltips(true),
iconType: () => (
<WfoCommandLine
color={
isSelected(CodeView.RAW)
? theme.colors.ghost
: theme.colors.textPrimary
}
/>
<div onClick={() => setShowTooltips(false)}>
<WfoCommandLine
color={
isSelected(CodeView.RAW)
? theme.colors.ghost
: theme.colors.textPrimary
}
/>
</div>
),
'data-test-id': 'rawCodeViewButton',
toolTipContent: t('codeView.raw'),
toolTipContent: showTooltips ? t('codeView.raw') : undefined,
style: {
backgroundColor: isSelected(CodeView.RAW)
? theme.colors.textPrimary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"traceback": "Traceback",
"codeView": {
"json": "JSON",
"table": "Tab",
"table": "Table",
"raw": "Raw"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"traceback": "Traceback",
"codeView": {
"json": "JSON",
"table": "Tab",
"table": "Table",
"raw": "Raw"
}
},
Expand Down
Loading