2020-09-03 17:26:36 +00:00
|
|
|
import React, { useContext } from "react";
|
|
|
|
import {
|
|
|
|
Page,
|
|
|
|
PageHeader,
|
|
|
|
PageHeaderTools,
|
|
|
|
PageHeaderToolsItem,
|
|
|
|
} from "@patternfly/react-core";
|
2020-09-04 10:38:58 +00:00
|
|
|
import { Meta } from "@storybook/react";
|
2020-09-03 17:26:36 +00:00
|
|
|
|
2020-09-08 17:12:42 +00:00
|
|
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
2020-09-03 17:26:36 +00:00
|
|
|
import {
|
|
|
|
Help,
|
|
|
|
HelpContext,
|
|
|
|
HelpHeader,
|
|
|
|
} from "../components/help-enabler/HelpHeader";
|
2020-09-08 17:12:42 +00:00
|
|
|
import { I18nextProvider } from "react-i18next";
|
2020-09-10 18:04:03 +00:00
|
|
|
import i18n from "../i18n";
|
2020-09-03 17:26:36 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
title: "Help System Example",
|
|
|
|
component: HelpHeader,
|
|
|
|
} as Meta;
|
|
|
|
|
2020-09-08 17:12:42 +00:00
|
|
|
export const HelpSystem = () => (
|
|
|
|
<Help>
|
|
|
|
<HelpSystemTest />
|
|
|
|
</Help>
|
|
|
|
);
|
|
|
|
|
|
|
|
export const HelpItemz = () => (
|
|
|
|
<I18nextProvider i18n={i18n}>
|
|
|
|
<HelpItem item="storybook" />
|
|
|
|
</I18nextProvider>
|
|
|
|
);
|
2020-09-03 17:26:36 +00:00
|
|
|
|
|
|
|
const HelpSystemTest = () => {
|
|
|
|
const { enabled } = useContext(HelpContext);
|
|
|
|
return (
|
|
|
|
<Page
|
|
|
|
header={
|
|
|
|
<PageHeader
|
|
|
|
headerTools={
|
|
|
|
<PageHeaderTools>
|
|
|
|
<PageHeaderToolsItem>
|
|
|
|
<HelpHeader />
|
|
|
|
</PageHeaderToolsItem>
|
|
|
|
<PageHeaderToolsItem>dummy user...</PageHeaderToolsItem>
|
|
|
|
</PageHeaderTools>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
Help system is {enabled ? "enabled" : "not on, guess you don't need help"}
|
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
};
|