diff --git a/.changeset/pretty-beans-juggle.md b/.changeset/pretty-beans-juggle.md new file mode 100644 index 000000000..785cd909e --- /dev/null +++ b/.changeset/pretty-beans-juggle.md @@ -0,0 +1,5 @@ +--- +'@orchestrator-ui/orchestrator-ui-components': patch +--- + +2256 Fix tooltip visible after clicking diff --git a/packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStep/WfoCodeViewSelector.tsx b/packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStep/WfoCodeViewSelector.tsx index 6eac0daad..b9419ab0f 100644 --- a/packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStep/WfoCodeViewSelector.tsx +++ b/packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStep/WfoCodeViewSelector.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react'; +import React, { useCallback, useState } from 'react'; import { useTranslations } from 'next-intl'; @@ -27,22 +27,26 @@ export const WfoCodeViewSelector = ({ const isSelected = (buttonView: CodeView): boolean => buttonView === codeView; + const [showTooltips, setShowTooltips] = useState(true); const codeViewOptions = [ { id: CodeView.JSON, label: t('codeView.json'), + onMouseLeave: () => setShowTooltips(true), iconType: () => ( - +
setShowTooltips(false)}> + +
), 'data-test-id': 'jsonCodeViewButton', - toolTipContent: t('codeView.json'), + toolTipContent: showTooltips ? t('codeView.json') : undefined, style: { backgroundColor: isSelected(CodeView.JSON) ? theme.colors.textPrimary @@ -52,17 +56,20 @@ export const WfoCodeViewSelector = ({ { id: CodeView.TABLE, label: t('codeView.table'), + onMouseLeave: () => setShowTooltips(true), iconType: () => ( - +
setShowTooltips(false)}> + +
), 'data-test-id': 'tableCodeViewButton', - toolTipContent: t('codeView.table'), + toolTipContent: showTooltips ? t('codeView.table') : undefined, style: { backgroundColor: isSelected(CodeView.TABLE) ? theme.colors.textPrimary @@ -72,17 +79,20 @@ export const WfoCodeViewSelector = ({ { id: CodeView.RAW, label: t('codeView.raw'), + onMouseLeave: () => setShowTooltips(true), iconType: () => ( - +
setShowTooltips(false)}> + +
), 'data-test-id': 'rawCodeViewButton', - toolTipContent: t('codeView.raw'), + toolTipContent: showTooltips ? t('codeView.raw') : undefined, style: { backgroundColor: isSelected(CodeView.RAW) ? theme.colors.textPrimary diff --git a/packages/orchestrator-ui-components/src/messages/en-GB.json b/packages/orchestrator-ui-components/src/messages/en-GB.json index 197d43c6a..1d31ab634 100644 --- a/packages/orchestrator-ui-components/src/messages/en-GB.json +++ b/packages/orchestrator-ui-components/src/messages/en-GB.json @@ -254,7 +254,7 @@ "traceback": "Traceback", "codeView": { "json": "JSON", - "table": "Tab", + "table": "Table", "raw": "Raw" } }, diff --git a/packages/orchestrator-ui-components/src/messages/nl-NL.json b/packages/orchestrator-ui-components/src/messages/nl-NL.json index 03985af51..b3021a83e 100644 --- a/packages/orchestrator-ui-components/src/messages/nl-NL.json +++ b/packages/orchestrator-ui-components/src/messages/nl-NL.json @@ -251,7 +251,7 @@ "traceback": "Traceback", "codeView": { "json": "JSON", - "table": "Tab", + "table": "Table", "raw": "Raw" } },