import { Alert, AlertDescription, AlertTitle, Link, Tab, TabList, TabPanel, TabPanels, Tabs } from "@chakra-ui/react"; import React from "react"; import { getComponent } from "../Custom"; interface TabsProps { fitWidth?: boolean, tabsVariant?: string, tabPanels: any[], tabNames: string[], tabListBgColor?: string, tabsBgColor?: string, tabSpacing?: string, tabsTextColor?: string, selectedTabBgColor?: string, selectedTabTextColor?: string, tabPanelBgColor?: string, } const RenderComponent = (props: any) => { const { data } = props; const componentName = data.componentName; try { const DynamicComponent = getComponent(componentName); return ( ); } catch (e) { return ( Error: Unrecognized component: {componentName}. Didn't receive a valid component. Please refer to TabLayout Documentation ); } } const TabLayout = (props: TabsProps) => { const { fitWidth = true, tabsVariant = 'solid-rounded', tabNames = ["Default"], tabPanels = [], tabListBgColor = "transparent", tabsBgColor = "#ffffff", tabSpacing = "10px", tabsTextColor = "#636363", selectedTabBgColor = "#028AE7", selectedTabTextColor = "black", tabPanelBgColor = "#F7F7F7" } = props; return ( {tabNames.map((tab: string, i: number) => ( {tab} ))} {tabPanels.map((content: any, index:number) => ( ))} ); }; export default TabLayout;