.
import React, { Fragment, useEffect, useRef, useState } from "react";
-import { MenuItem, Paper, Tab, Tabs } from "@mui/material";
-import HelpItem from "./HelpItem";
+import ReactMarkdown from "react-markdown";
+import styled from "styled-components";
+import get from "lodash/get";
import {
AlertCloseIcon,
Box,
@@ -25,14 +26,42 @@ import {
HelpIconFilled,
IconButton,
MinIOTierIcon,
+ TabItemProps,
+ Tabs,
} from "mds";
import { useSelector } from "react-redux";
import { AppState, useAppDispatch } from "../../store";
-import { TabPanel } from "../shared/tabs";
import { setHelpTabName } from "../../systemSlice";
import { DocItem } from "./HelpMenu.types";
+import HelpItem from "./HelpItem";
import MoreLink from "../../common/MoreLink";
-import ReactMarkdown from "react-markdown";
+
+const HelpMenuContainer = styled.div(({ theme }) => ({
+ backgroundColor: get(theme, "bgColor", "#FFF"),
+ position: "absolute",
+ zIndex: "10",
+ border: `${get(theme, "borderColor", "#E2E2E2")} 1px solid`,
+ borderRadius: 4,
+ boxShadow: "rgba(0, 0, 0, 0.1) 0px 0px 10px",
+ width: 754,
+ "& .tabsPanels": {
+ padding: "15px 0 0",
+ },
+ "& .helpContainer": {
+ maxHeight: 400,
+ overflowY: "auto",
+ "& .helpItemBlock": {
+ padding: 5,
+ "&:hover": {
+ backgroundColor: get(
+ theme,
+ "buttons.regular.hover.background",
+ "#E6EAEB",
+ ),
+ },
+ },
+ },
+}));
const HelpMenu = () => {
const helpTopics = require("../Console/helpTopics.json");
@@ -73,7 +102,7 @@ const HelpMenu = () => {
}, [ref]);
}
- const wrapperRef = useRef(null);
+ const wrapperRef = useRef
(null);
useOutsideAlerter(wrapperRef);
useEffect(() => {
@@ -148,7 +177,7 @@ const HelpMenu = () => {
]);
const helpContent = (
-
+
{headerDocs && (
@@ -159,9 +188,9 @@ const HelpMenu = () => {
)}
{helpItems &&
helpItems.map((aHelpItem, idx) => (
-
+
))}
{
color={"#C5293F"}
/>
-
+
);
const helpContentVideo = (
-
+
{headerVideo && (
@@ -185,9 +214,9 @@ const HelpMenu = () => {
)}
{helpItemsVideo &&
helpItemsVideo.map((aHelpItem, idx) => (
-
+
))}
{
color={"#C5293F"}
/>
-
+
);
const helpContentBlog = (
-
+
{headerBlog && (
@@ -211,9 +240,9 @@ const HelpMenu = () => {
)}
{helpItemsBlog &&
helpItemsBlog.map((aHelpItem, idx) => (
-
+
))}
{
color={"#C5293F"}
/>
-
+
);
- function a11yProps(index: any) {
- return {
- id: `simple-tab-${index}`,
- "aria-controls": `simple-tabpanel-${index}`,
- style: {
- fontWeight: "bold",
- },
- };
- }
+ const constructHMTabs = () => {
+ const helpMenuElements: TabItemProps[] = [];
+
+ if (helpItems.length !== 0) {
+ helpMenuElements.push({
+ tabConfig: { label: "Documentation", id: "docs" },
+ content: helpContent,
+ });
+ }
+
+ if (helpItemsVideo.length !== 0) {
+ helpMenuElements.push({
+ tabConfig: { label: "Video", id: "video" },
+ content: helpContentVideo,
+ });
+ }
+
+ if (helpItemsBlog.length !== 0) {
+ helpMenuElements.push({
+ tabConfig: { label: "Blog", id: "blog" },
+ content: helpContentBlog,
+ });
+ }
+
+ return helpMenuElements;
+ };
return (
{helpMenuOpen && (
-
-
-
-
-
-
-
- , newValue: string) => {
- dispatch(setHelpTabName(newValue));
- }}
- indicatorColor="primary"
- textColor="primary"
- aria-label="cluster-tabs"
- variant="scrollable"
- scrollButtons="auto"
- >
- {helpItems.length !== 0 && (
-
- )}
- {helpItemsVideo.length !== 0 && (
-
- )}
- {helpItemsBlog.length !== 0 && (
-
- )}
-
-
-
+
+ dispatch(setHelpTabName(item))}
+ optionsInitialComponent={
+
+
+
+ }
+ optionsEndComponent={
+
{
setHelpMenuOpen(false);
@@ -301,32 +307,12 @@ const HelpMenu = () => {
>
-
-
-
- {helpItems.length !== 0 && (
-
- {helpContent}
-
- )}
- {helpItemsVideo.length !== 0 && (
-
- {helpContentVideo}
-
- )}
- {helpItemsBlog.length !== 0 && (
-
- {helpContentBlog}
-
- )}
-
-
-
+
+ }
+ horizontalBarBackground
+ horizontal
+ />
+
)}
.
-
-import React, { Fragment } from "react";
-
-interface TabPanelProps {
- children?: React.ReactNode;
- index: any;
- value: any;
-}
-
-export const TabPanel = (props: TabPanelProps) => {
- const { children, value, index, ...other } = props;
-
- return (
-
- {value === index && {children}}
-
- );
-};