Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(UI): Replace most patternfly tooltips with browser ones #1642

Merged
merged 1 commit into from
Dec 3, 2024
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
26 changes: 12 additions & 14 deletions packages/ui/src/components/Catalog/CatalogFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
SearchInput,
ToggleGroup,
ToggleGroupItem,
Tooltip,
capitalize,
} from '@patternfly/react-core';
import { TimesCircleIcon } from '@patternfly/react-icons';
Expand Down Expand Up @@ -110,19 +109,18 @@
<FormGroup label="Layout" fieldId="layout">
<ToggleGroup aria-label="Change layout">
{props.layouts.map((key) => (
<Tooltip key={key} aria-label="Layout toggle Tooltip" content={<p>Display elements with a {key} view</p>}>
<ToggleGroupItem
icon={<CatalogLayoutIcon key={key} layout={key} />}
key={key}
data-testid={`toggle-layout-button-${key}`}
buttonId={`toggle-layout-button-${key}`}
aria-label={`toggle-layout-button-${key}`}
isSelected={props.activeLayout === key}
onChange={() => {
props.setActiveLayout(key);
}}
/>
</Tooltip>
<ToggleGroupItem

Check warning on line 112 in packages/ui/src/components/Catalog/CatalogFilter.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Catalog/CatalogFilter.tsx#L112

Added line #L112 was not covered by tests
title={`Display elements with a ${key} view`}
icon={<CatalogLayoutIcon key={key} layout={key} />}
key={key}
data-testid={`toggle-layout-button-${key}`}
buttonId={`toggle-layout-button-${key}`}
aria-label={`toggle-layout-button-${key}`}
isSelected={props.activeLayout === key}
onChange={() => {
props.setActiveLayout(key);

Check warning on line 121 in packages/ui/src/components/Catalog/CatalogFilter.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Catalog/CatalogFilter.tsx#L120-L121

Added lines #L120 - L121 were not covered by tests
}}
/>
))}
</ToggleGroup>
</FormGroup>
Expand Down
42 changes: 20 additions & 22 deletions packages/ui/src/components/Form/properties/AddPropertyButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Split, SplitItem, Tooltip } from '@patternfly/react-core';
import { Button, Split, SplitItem } from '@patternfly/react-core';
import { FolderPlusIcon, PlusCircleIcon } from '@patternfly/react-icons';

type AddPropertyPopoverProps = {
Expand All @@ -24,32 +24,30 @@ export function AddPropertyButtons({
return (
<Split>
<SplitItem>
<Tooltip content="Add string property">
<Button
title="Add string property"
data-testid={`properties-add-string-property-${path.join('-')}-btn`}
variant={'link'}
icon={<PlusCircleIcon />}
isDisabled={disabled}
onClick={() => createPlaceholder(false)}
>
{showLabel && 'Add string property'}
</Button>
</SplitItem>

{canAddObjectProperties && (
<SplitItem>
<Button
data-testid={`properties-add-string-property-${path.join('-')}-btn`}
title="Add object property"
data-testid={`properties-add-object-property-${path.join('-')}-btn`}
variant={'link'}
icon={<PlusCircleIcon />}
icon={<FolderPlusIcon />}
isDisabled={disabled}
onClick={() => createPlaceholder(false)}
onClick={() => createPlaceholder(true)}
>
{showLabel && 'Add string property'}
{showLabel && 'Add object property'}
</Button>
</Tooltip>
</SplitItem>

{canAddObjectProperties && (
<SplitItem>
<Tooltip content="Add object property">
<Button
data-testid={`properties-add-object-property-${path.join('-')}-btn`}
variant={'link'}
icon={<FolderPlusIcon />}
isDisabled={disabled}
onClick={() => createPlaceholder(true)}
>
{showLabel && 'Add object property'}
</Button>
</Tooltip>
</SplitItem>
)}
</Split>
Expand Down
66 changes: 31 additions & 35 deletions packages/ui/src/components/Form/properties/PropertyRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, HelperText, HelperTextItem, Split, SplitItem, TextInput, Tooltip } from '@patternfly/react-core';
import { Button, HelperText, HelperTextItem, Split, SplitItem, TextInput } from '@patternfly/react-core';
import { CheckIcon, PencilAltIcon, TimesIcon, TrashIcon } from '@patternfly/react-icons';
import { Td, TdProps, TreeRowWrapper } from '@patternfly/react-table';
import { FormEvent, useState } from 'react';
Expand Down Expand Up @@ -149,49 +149,45 @@ export function PropertyRow({
{isEditing
? [
<SplitItem key={`${getKey()}-property-edit-confirm-${nodeName}`}>
<Tooltip content="Confirm edit">
<Button
data-testid={`${getKey()}-property-edit-confirm-${nodeName}-btn`}
icon={<CheckIcon />}
variant="link"
isDisabled={isUserInputInvalid()}
onClick={commitUserInput}
/>
</Tooltip>
<Button
title="Confirm edit"
data-testid={`${getKey()}-property-edit-confirm-${nodeName}-btn`}
icon={<CheckIcon />}
variant="link"
isDisabled={isUserInputInvalid()}
onClick={commitUserInput}
/>
</SplitItem>,
<SplitItem key={`${getKey()}-property-edit-cancel-${nodeName}`}>
<Tooltip content="Cancel edit">
<Button
data-testid={`${getKey()}-property-edit-cancel-${nodeName}-btn`}
icon={<TimesIcon />}
variant="link"
onClick={cancelEditing}
/>
</Tooltip>
<Button
title="Cancel edit"
data-testid={`${getKey()}-property-edit-cancel-${nodeName}-btn`}
icon={<TimesIcon />}
variant="link"
onClick={cancelEditing}
/>
</SplitItem>,
]
: [
<SplitItem key={`${getKey()}-property-edit-${nodeName}`}>
<Tooltip content="Edit property">
<Button
data-testid={`${getKey()}-property-edit-${nodeName}-btn`}
icon={<PencilAltIcon />}
variant="link"
onClick={() => setIsEditing(true)}
/>
</Tooltip>
<Button
title="Edit property"
data-testid={`${getKey()}-property-edit-${nodeName}-btn`}
icon={<PencilAltIcon />}
variant="link"
onClick={() => setIsEditing(true)}
/>
</SplitItem>,
<SplitItem key={`${getKey()}-property-edit-spacer-${nodeName}`}></SplitItem>,
<SplitItem key={`${getKey()}-property-edit-spacer-${nodeName}`} />,
]}
<SplitItem key={`${getKey()}-property-delete-${nodeName}`}>
<Tooltip content="Delete property">
<Button
data-testid={`${getKey()}-delete-${nodeName}-btn`}
icon={<TrashIcon />}
variant="link"
onClick={() => handleTrashClick(parentModel, nodeName)}
></Button>
</Tooltip>
<Button
title="Delete property"
data-testid={`${getKey()}-delete-${nodeName}-btn`}
icon={<TrashIcon />}
variant="link"
onClick={() => handleTrashClick(parentModel, nodeName)}
/>
</SplitItem>
</Split>
</Td>
Expand Down
34 changes: 16 additions & 18 deletions packages/ui/src/components/MetadataEditor/TopmostArrayTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import './MetadataEditor.scss';
import { Button, EmptyState, EmptyStateBody, Tooltip, Truncate } from '@patternfly/react-core';
import { Button, EmptyState, EmptyStateBody, Truncate } from '@patternfly/react-core';
import { PlusCircleIcon, TrashIcon } from '@patternfly/react-icons';
import {
InnerScrollContainer,
Expand All @@ -12,6 +11,7 @@ import {
Thead,
Tr,
} from '@patternfly/react-table';
import './MetadataEditor.scss';

type TopmostArrayTableProps = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -58,14 +58,13 @@ export function TopmostArrayTable(props: TopmostArrayTableProps) {
</Th>
))}
<Td modifier="nowrap" key="buttons" isActionCell>
<Tooltip content={`Add new ${props.name}`}>
<Button
data-testid={'metadata-add-' + props.name + '-btn'}
icon={<PlusCircleIcon />}
variant="link"
onClick={() => handleAddNew()}
></Button>
</Tooltip>
<Button
title={`Add new ${props.name}`}
data-testid={'metadata-add-' + props.name + '-btn'}
icon={<PlusCircleIcon />}
variant="link"
onClick={() => handleAddNew()}
/>
</Td>
</Tr>
</Thead>
Expand Down Expand Up @@ -102,14 +101,13 @@ export function TopmostArrayTable(props: TopmostArrayTableProps) {
</Td>
))}
<Td key="buttons" isActionCell>
<Tooltip content={`Delete ${props.name}`}>
<Button
data-testid={'metadata-delete-' + index + '-btn'}
icon={<TrashIcon />}
variant="link"
onClick={() => handleTrashClick(index)}
></Button>
</Tooltip>
<Button
title={`Delete ${props.name}`}
data-testid={'metadata-delete-' + index + '-btn'}
icon={<TrashIcon />}
variant="link"
onClick={() => handleTrashClick(index)}
/>
</Td>
</Tr>
))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import {
Button,
Grid,
GridItem,
SearchInput,
Title,
ToggleGroup,
ToggleGroupItem,
Tooltip,
} from '@patternfly/react-core';
import { Button, Grid, GridItem, SearchInput, Title, ToggleGroup, ToggleGroupItem } from '@patternfly/react-core';
import { TimesIcon } from '@patternfly/react-icons';
import { FunctionComponent, useContext } from 'react';
import { CanvasFormTabsContext } from '../../../../providers/canvas-form-tabs.provider';
import { FilteredFieldContext } from '../../../../providers/filtered-field.provider';
import { FormTabsModes } from './canvasformtabs.modes';
import './CanvasFormHeader.scss';
import { FormTabsModes } from './canvasformtabs.modes';

interface CanvasFormHeaderProps {
nodeId: string;
Expand Down Expand Up @@ -43,15 +34,14 @@ export const CanvasFormHeader: FunctionComponent<CanvasFormHeaderProps> = (props
{canvasFormTabsContext && (
<ToggleGroup aria-label="Single selectable form tabs" className="form-tabs">
{Object.entries(FormTabsModes).map(([mode, tooltip]) => (
<Tooltip key={mode} content={tooltip}>
<ToggleGroupItem
key={mode}
text={mode}
buttonId={mode}
isSelected={canvasFormTabsContext.selectedTab === mode}
onChange={canvasFormTabsContext.onTabChange}
/>
</Tooltip>
<ToggleGroupItem
title={tooltip}
key={mode}
text={mode}
buttonId={mode}
isSelected={canvasFormTabsContext.selectedTab === mode}
onChange={canvasFormTabsContext.onTabChange}
/>
))}
</ToggleGroup>
)}
Expand Down
Loading
Loading