2020-09-25 17:11:25 +00:00
|
|
|
import React, { useContext } from "react";
|
2020-09-08 17:12:42 +00:00
|
|
|
import { Tooltip } from "@patternfly/react-core";
|
|
|
|
import { HelpIcon } from "@patternfly/react-icons";
|
|
|
|
import { useTranslation } from "react-i18next";
|
2020-09-25 17:11:25 +00:00
|
|
|
import { HelpContext } from "./HelpHeader";
|
2020-09-08 17:12:42 +00:00
|
|
|
|
|
|
|
type HelpItemProps = {
|
|
|
|
item: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const HelpItem = ({ item }: HelpItemProps) => {
|
|
|
|
const { t } = useTranslation();
|
2020-09-25 17:11:25 +00:00
|
|
|
const { enabled } = useContext(HelpContext);
|
2020-09-08 17:12:42 +00:00
|
|
|
return (
|
2020-09-25 17:11:25 +00:00
|
|
|
<>
|
|
|
|
{enabled && (
|
|
|
|
<Tooltip position="right" content={t(`help:${item}`)}>
|
|
|
|
<span id={item} data-testid={item}>
|
|
|
|
<HelpIcon />
|
|
|
|
</span>
|
|
|
|
</Tooltip>
|
|
|
|
)}
|
|
|
|
</>
|
2020-09-08 17:12:42 +00:00
|
|
|
);
|
|
|
|
};
|