Skip to content

Commit

Permalink
replace tooltips with popovers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Oct 12, 2023
1 parent 490d7a9 commit e07c589
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 51 deletions.
32 changes: 7 additions & 25 deletions src/app/SecurityPanel/Credentials/StoreCredentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
EmptyState,
EmptyStateIcon,
Icon,

Check warning on line 35 in src/app/SecurityPanel/Credentials/StoreCredentials.tsx

View workflow job for this annotation

GitHub Actions / eslint-check (16.x)

'Icon' is defined but never used

Check warning on line 35 in src/app/SecurityPanel/Credentials/StoreCredentials.tsx

View workflow job for this annotation

GitHub Actions / eslint-check (18.x)

'Icon' is defined but never used
Popover,
Text,
TextContent,
TextVariants,
Expand Down Expand Up @@ -520,35 +521,16 @@ export const CheckBoxActions: React.FC<CheckBoxActionsProps> = ({
);
};

const CredentialsTooltip: React.FC<{}> = () => {
const [visible, setVisible] = React.useState(false);

return (
<Tooltip
aria="none"
aria-live="polite"
trigger="manual"
isVisible={visible}
isContentLeftAligned
maxWidth="40rem"
content={
<JmxAuthDescription>
<Text component={TextVariants.h3}>JMX Authentication</Text>
</JmxAuthDescription>
}
>
<Button variant="plain" onClick={() => setVisible((v) => !v)}>
<OutlinedQuestionCircleIcon />
</Button>
</Tooltip>
);
};

export const StoreCredentialsCard: SecurityCard = {
key: 'credentials',
title: (
<Text>
Store Credentials <CredentialsTooltip />
Store Credentials
<Popover maxWidth="40rem" headerContent="JMX Authentication" bodyContent={<JmxAuthDescription />}>
<Button variant="plain">
<OutlinedQuestionCircleIcon />
</Button>
</Popover>
</Text>
),
description: (
Expand Down
33 changes: 7 additions & 26 deletions src/app/SecurityPanel/ImportCertificate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { JmxSslDescription } from '@app/Shared/Components/JmxSslDescription';
import { Button, Icon, Text, TextContent, TextVariants, Tooltip } from '@patternfly/react-core';
import { Button, Icon, Popover, Text, TextContent, TextVariants, Tooltip } from '@patternfly/react-core';

Check warning on line 18 in src/app/SecurityPanel/ImportCertificate.tsx

View workflow job for this annotation

GitHub Actions / eslint-check (16.x)

'Icon' is defined but never used

Check warning on line 18 in src/app/SecurityPanel/ImportCertificate.tsx

View workflow job for this annotation

GitHub Actions / eslint-check (16.x)

'Tooltip' is defined but never used

Check warning on line 18 in src/app/SecurityPanel/ImportCertificate.tsx

View workflow job for this annotation

GitHub Actions / eslint-check (18.x)

'Icon' is defined but never used

Check warning on line 18 in src/app/SecurityPanel/ImportCertificate.tsx

View workflow job for this annotation

GitHub Actions / eslint-check (18.x)

'Tooltip' is defined but never used
import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons';
import * as React from 'react';
import { CertificateUploadModal } from './CertificateUploadModal';
Expand All @@ -38,35 +38,16 @@ export const CertificateImport: React.FC = () => {
);
};

const CertificateTooltip: React.FC<{}> = () => {
const [visible, setVisible] = React.useState(false);

return (
<Tooltip
aria="none"
aria-live="polite"
trigger="manual"
isVisible={visible}
isContentLeftAligned
maxWidth="40rem"
content={
<JmxSslDescription>
<Text component={TextVariants.h3}>JMX over SSL</Text>
</JmxSslDescription>
}
>
<Button variant="plain" onClick={() => setVisible((v) => !v)}>
<OutlinedQuestionCircleIcon />
</Button>
</Tooltip>
);
};

export const ImportCertificate: SecurityCard = {
key: 'ssl',
title: (
<Text>
Import SSL Certificates <CertificateTooltip />
Import SSL Certificates
<Popover maxWidth="40rem" headerContent="JMX over SSL" bodyContent={<JmxSslDescription />}>
<Button variant="plain">
<OutlinedQuestionCircleIcon />
</Button>
</Popover>
</Text>
),
description: (
Expand Down

0 comments on commit e07c589

Please sign in to comment.