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

Bug 1856511: Correct alignment of help icons #6029

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 21 additions & 29 deletions frontend/packages/kubevirt-plugin/src/components/form/form-row.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { FormGroup } from '@patternfly/react-core';
import { FormGroup, Popover, PopoverPosition } from '@patternfly/react-core';
import { HelpIcon } from '@patternfly/react-icons';
import * as classnames from 'classnames';
import { LoadingInline } from '@console/internal/components/utils';
import { PopoverStatus, ValidationErrorType, StatusIconAndText } from '@console/shared';
import { ValidationErrorType } from '@console/shared';

import './form-row.scss';

export const FormRow: React.FC<FormRowProps> = ({
Expand All @@ -19,9 +19,6 @@ export const FormRow: React.FC<FormRowProps> = ({
children,
className,
}) => {
const [isActive, setActive] = React.useState(false);
const onHide = React.useCallback(() => setActive(false), [setActive]);
const onShow = React.useCallback(() => setActive(true), [setActive]);
if (isHidden) {
return null;
}
Expand All @@ -39,30 +36,25 @@ export const FormRow: React.FC<FormRowProps> = ({
type === ValidationErrorType.Info || type === ValidationErrorType.Warn ? message : undefined
}
className={className}
>
{help && (
<span className="kubevirt-form-row__icon-status-container">
<PopoverStatus
title={`${fieldId} help`}
hideHeader
onHide={onHide}
onShow={onShow}
statusBody={
<StatusIconAndText
title={`${fieldId} help`}
iconOnly
icon={
<HelpIcon
className={classnames({ 'kubevirt-form-row__help-icon--hidden': !isActive })}
/>
}
/>
}
labelIcon={
help && (
<Popover
position={PopoverPosition.right}
aria-label={`${fieldId} help`}
bodyContent={help}
>
{help}
</PopoverStatus>
</span>
)}
<button
pcbailey marked this conversation as resolved.
Show resolved Hide resolved
type="button"
pcbailey marked this conversation as resolved.
Show resolved Hide resolved
onClick={(e) => e.preventDefault()}
className="pf-c-form__group-label-help"
aria-label={`${fieldId} help`}
>
<HelpIcon noVerticalAlign />
</button>
</Popover>
)
}
>
{isLoading && (
<span className="kubevirt-form-row__loading-container">
<LoadingInline />
Expand Down