keycloak-scim/src/components/help-enabler/HelpItem.tsx
Stan Silvert f2e26b0049
Cypress tests for masthead. (#304)
* Cypress tests for masthead.

* Update snapshot

* Update Keycloak version.

* Fix download address

* Update start.js

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Follow redirect when downloading keycloak.

* Refactor HeaderPage into Masthead and ModalUtils

* Minor change to kick off build.

* logOutTest no longer needs a param

* goToAcctMgtTest no longer needs a param

* Update tests/cypress/support/pages/admin_console/Masthead.js

Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>

* Update tests/cypress/support/pages/admin_console/Masthead.js

Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>

* Fix userDropdown() method

* Minor refactor

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>
2021-01-21 07:09:50 -05:00

33 lines
920 B
TypeScript

import React, { useContext } from "react";
import { Popover } from "@patternfly/react-core";
import { HelpIcon } from "@patternfly/react-icons";
import { useTranslation } from "react-i18next";
import { HelpContext } from "./HelpHeader";
type HelpItemProps = {
helpText: string;
forLabel: string;
forID: string;
};
export const HelpItem = ({ helpText, forLabel, forID }: HelpItemProps) => {
const { t } = useTranslation();
const { enabled } = useContext(HelpContext);
return (
<>
{enabled && (
<Popover bodyContent={t(helpText)}>
<button
id={helpText}
aria-label={t(`helpLabel`, { label: forLabel })}
onClick={(e) => e.preventDefault()}
aria-describedby={forID}
className="pf-c-form__group-label-help"
>
<HelpIcon noVerticalAlign />
</button>
</Popover>
)}
</>
);
};