diff --git a/app/client/src/components/designSystems/appsmith/TabsComponent.tsx b/app/client/src/components/designSystems/appsmith/TabsComponent.tsx index 06c79f905b..081432f861 100644 --- a/app/client/src/components/designSystems/appsmith/TabsComponent.tsx +++ b/app/client/src/components/designSystems/appsmith/TabsComponent.tsx @@ -22,6 +22,12 @@ interface TabsComponentProps extends ComponentProps { }>; } +type ChildrenWrapperProps = Pick; + +const TAB_CONTAINER_HEIGHT = "40px"; +const CHILDREN_WRAPPER_HEIGHT_WITH_TABS = `calc(100% - ${TAB_CONTAINER_HEIGHT})`; +const CHILDREN_WRAPPER_HEIGHT_WITHOUT_TABS = "100%"; + const scrollContents = css` overflow-y: auto; position: absolute; @@ -41,8 +47,11 @@ const TabsContainerWrapper = styled.div<{ overflow: hidden; `; -const ChildrenWrapper = styled.div` - height: calc(100% - 40px); +const ChildrenWrapper = styled.div` + height: ${({ shouldShowTabs }) => + shouldShowTabs + ? CHILDREN_WRAPPER_HEIGHT_WITH_TABS + : CHILDREN_WRAPPER_HEIGHT_WITHOUT_TABS}; width: 100%; position: relative; background: ${(props) => props.theme.colors.builderBodyBG}; @@ -66,7 +75,7 @@ const TabsContainer = styled.div` background: ${(props) => props.theme.colors.builderBodyBG}; overflow: hidden; && { - height: 40px; + height: ${TAB_CONTAINER_HEIGHT}; width: 100%; display: flex; justify-content: flex-start; @@ -123,6 +132,7 @@ function TabsComponent(props: TabsComponentProps) { tabContainerRef.current?.scrollTo({ top: 0, behavior: "smooth" }); } }, [props.shouldScrollContents]); + return ( {props.shouldShowTabs ? ( @@ -146,7 +156,7 @@ function TabsComponent(props: TabsComponentProps) { ) : ( undefined )} - +