diff --git a/packages/app-page-builder-elements/src/renderers/tabs.tsx b/packages/app-page-builder-elements/src/renderers/tabs.tsx index 227749c8cbf..937489b9284 100644 --- a/packages/app-page-builder-elements/src/renderers/tabs.tsx +++ b/packages/app-page-builder-elements/src/renderers/tabs.tsx @@ -3,6 +3,7 @@ import styled from "@emotion/styled"; import { Elements } from "~/components/Elements"; import { createRenderer } from "~/createRenderer"; import { useRenderer } from "~/hooks/useRenderer"; +import { ClassNames } from "@emotion/react"; const TabsHeader = styled.div` display: flex; @@ -44,17 +45,24 @@ export const createTabs = () => { return ( <> - {element.elements.map((tab, index) => ( - { - setSelectedTabElement(tab); - }} - active={tab.id === selectedTabElement.id} - > - {tab.data?.settings?.tab?.label || ""} - - ))} + {element.elements.map((tab, index) => { + const active = tab.id === selectedTabElement.id; + return ( + + {({ cx }) => ( + { + setSelectedTabElement(tab); + }} + > + {tab.data?.settings?.tab?.label || ""} + + )} + + ); + })} diff --git a/packages/app-page-builder/src/editor/plugins/elements/tabs/PeTabs.tsx b/packages/app-page-builder/src/editor/plugins/elements/tabs/PeTabs.tsx index 535e18b4882..87b56cec421 100644 --- a/packages/app-page-builder/src/editor/plugins/elements/tabs/PeTabs.tsx +++ b/packages/app-page-builder/src/editor/plugins/elements/tabs/PeTabs.tsx @@ -5,6 +5,7 @@ import { createRenderer, useRenderer, Elements } from "@webiny/app-page-builder- import { Element as ElementType } from "@webiny/app-page-builder-elements/types"; import { useActiveElementId } from "~/editor/hooks/useActiveElementId"; import { elementWithChildrenByIdSelector } from "~/editor/recoil/modules"; +import { ClassNames } from "@emotion/react"; const TabsContainer = styled.div` width: 100%; @@ -62,18 +63,25 @@ const PeTabs = createRenderer(() => { return ( - {childrenElements.map((tab, index) => ( - { - setSelectedTabElement(tab); - setActiveElementId(tab.id); - }} - active={tab.id === selectedTabElement.id} - > - {tab.data?.settings?.tab?.label || ""} - - ))} + {childrenElements.map((tab, index) => { + const active = tab.id === selectedTabElement.id; + return ( + + {({ cx }) => ( + { + setSelectedTabElement(tab); + setActiveElementId(tab.id); + }} + > + {tab.data?.settings?.tab?.label || ""} + + )} + + ); + })}