diff --git a/src/components/help-enabler/HelpItem.test.tsx b/src/components/help-enabler/HelpItem.test.tsx new file mode 100644 index 0000000000..62297a6999 --- /dev/null +++ b/src/components/help-enabler/HelpItem.test.tsx @@ -0,0 +1,11 @@ +import React from "react"; +import { render } from "@testing-library/react"; + +import { HelpItem } from "./HelpItem"; + +describe("", () => { + it("render", () => { + const comp = render(); + expect(comp.asFragment()).toMatchSnapshot(); + }); +}); diff --git a/src/components/help-enabler/HelpItem.tsx b/src/components/help-enabler/HelpItem.tsx new file mode 100644 index 0000000000..f7ca0e3205 --- /dev/null +++ b/src/components/help-enabler/HelpItem.tsx @@ -0,0 +1,19 @@ +import React from "react"; +import { Tooltip } from "@patternfly/react-core"; +import { HelpIcon } from "@patternfly/react-icons"; +import { useTranslation } from "react-i18next"; + +type HelpItemProps = { + item: string; +}; + +export const HelpItem = ({ item }: HelpItemProps) => { + const { t } = useTranslation(); + return ( + + + + + + ); +}; diff --git a/src/components/help-enabler/__snapshots__/HelpItem.test.tsx.snap b/src/components/help-enabler/__snapshots__/HelpItem.test.tsx.snap new file mode 100644 index 0000000000..cf1f43377e --- /dev/null +++ b/src/components/help-enabler/__snapshots__/HelpItem.test.tsx.snap @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` render 1`] = ` + + + + + +`; diff --git a/src/help.json b/src/help.json new file mode 100644 index 0000000000..0d706d03e4 --- /dev/null +++ b/src/help.json @@ -0,0 +1,7 @@ +{ + "en": { + "help": { + "storybook": "Sometimes you need some help and it's nice when the app does that" + } + } +} diff --git a/src/i18n.ts b/src/i18n.ts index bb29a1cb7d..a83e535a42 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -3,9 +3,12 @@ import { initReactI18next } from "react-i18next"; // import backend from "i18next-http-backend"; import messages from "./messages.json"; +import help from "./help.json"; const initOptions = { - resources: messages, + ns: ["messages", "help"], + defaultNS: "messages", + resources: { ...messages, ...help }, lng: "en", fallbackLng: "en", saveMissing: true, diff --git a/src/messages.json b/src/messages.json index aebbbf6912..f7de1d2a5f 100644 --- a/src/messages.json +++ b/src/messages.json @@ -1,6 +1,6 @@ { "en": { - "translation": { + "messages": { "personalInfoHtmlTitle": "Personal Info", "personalInfoIntroMessage": "Manage your basic information", "Account Security": "Account Security", diff --git a/src/stories/HelpSystem.stories.tsx b/src/stories/HelpSystem.stories.tsx index b0078ff5a0..958cae6586 100644 --- a/src/stories/HelpSystem.stories.tsx +++ b/src/stories/HelpSystem.stories.tsx @@ -7,24 +7,31 @@ import { } from "@patternfly/react-core"; import { Meta } from "@storybook/react"; +import { HelpItem } from "../components/help-enabler/HelpItem"; import { Help, HelpContext, HelpHeader, } from "../components/help-enabler/HelpHeader"; +import { I18nextProvider } from "react-i18next"; +import { i18n } from "../i18n"; export default { title: "Help System Example", component: HelpHeader, } as Meta; -export const HelpSystem = () => { - return ( - - - - ); -}; +export const HelpSystem = () => ( + + + +); + +export const HelpItemz = () => ( + + + +); const HelpSystemTest = () => { const { enabled } = useContext(HelpContext);