+ {insertStyles &&
}
+
+
+ {tabsKeys.map((tabKey) => (
- {tabsData[tabKey]}
+ {tabsData[tabKey].element}
))}
diff --git a/packages/robindoc/src/components/ui/tabs/tabs-header/index.tsx b/packages/robindoc/src/components/ui/tabs/tabs-header/index.tsx
index 46378328..21837995 100644
--- a/packages/robindoc/src/components/ui/tabs/tabs-header/index.tsx
+++ b/packages/robindoc/src/components/ui/tabs/tabs-header/index.tsx
@@ -5,8 +5,8 @@ import clsx from "clsx";
import { saveTab } from "@src/core/utils/tabs-store";
export interface TabsHeaderProps {
- tabs: string[];
- tabsKey: string;
+ tabs: { name: string; id: string }[];
+ tabsTypeId: string;
type?: "code";
}
@@ -14,27 +14,27 @@ const typeClassNames = {
code: "r-tab-header-code",
};
-export const TabsHeader: React.FC
= ({ tabs, tabsKey, type }) => {
+export const TabsHeader: React.FC = ({ tabs, tabsTypeId, type }) => {
const changeTabHandler = (tab: string) => {
const classNames = Array.from(document.documentElement.classList);
classNames.forEach((className) => {
- if (className.startsWith(`r-tabs-global__${tabsKey}`)) {
+ if (className.startsWith(`r-tabs-global__${tabsTypeId}`)) {
document.documentElement.classList.remove(className);
}
});
- document.documentElement.classList.add(`r-tabs-global__${tabsKey}`, `r-tabs-global__${tabsKey}_${tab}`);
- saveTab(tabsKey, tab);
+ document.documentElement.classList.add(`r-tabs-global__${tabsTypeId}`, `r-tabs-global__${tabsTypeId}_${tab}`);
+ saveTab(tabsTypeId, tab);
};
return (
{tabs.map((tab) => (
changeTabHandler(tab)}
+ key={tab.id}
+ className={clsx(`r-tab-header r-tab-header_${tab.id}`, type && typeClassNames[type])}
+ onClick={() => changeTabHandler(tab.id)}
>
- {tab}
+ {tab.name}
))}
diff --git a/packages/robindoc/src/components/ui/tabs/tabs-styles/index.tsx b/packages/robindoc/src/components/ui/tabs/tabs-styles/index.tsx
index 19e67811..b5d454c6 100644
--- a/packages/robindoc/src/components/ui/tabs/tabs-styles/index.tsx
+++ b/packages/robindoc/src/components/ui/tabs/tabs-styles/index.tsx
@@ -1,18 +1,18 @@
import React from "react";
export interface TabsStylesProps {
- tabsKey: string;
- tabs: string[];
+ tabsTypeId: string;
+ tabsKeys: string[];
}
-export const TabsStyles: React.FC = ({ tabsKey, tabs }) => (
+export const TabsStyles: React.FC = ({ tabsTypeId, tabsKeys }) => (