Debian Codegraph @

install/freeipa-webui/src/components/layouts/TabLayout/TabLayout.tsx

raw
1 import React from "react";
2 import { Flex, FlexItem, PageSection } from "@patternfly/react-core";
3 import ToolbarLayout from "src/components/layouts/ToolbarLayout";
4 import { ToolbarItem } from "src/components/layouts/ToolbarLayout";
5
6 interface PropsToTab {
7 id: string;
8 children: React.ReactNode;
9 toolbarItems?: ToolbarItem[];
10 dataCy?: string;
11 }
12
13 // Float the tab content
14 const TabLayout = (props: PropsToTab) => {
15 const style: React.CSSProperties = {
16 overflowY: "auto",
17 maxHeight: "100dvh",
18 minHeight: `var(--tab-layout-calc)`,
19 };
20
21 return (
22 <div id={props.id + "-container"} data-cy={props.dataCy}>
23 <Flex direction={{ default: "column" }}>
24 <PageSection
25 hasBodyWrapper={false}
26 id={props.id}
27 style={style}
28 isFilled
29 className="pf-v6-u-pl-xl pf-v6-u-mb-0" // Slightly centers the content and removes the bottom margin
30 >
31 {props.children}
32 </PageSection>
33 {props.toolbarItems && (
34 <FlexItem
35 style={{
36 marginTop: 0,
37 position: "sticky",
38 bottom: 0,
39 }}
40 >
41 <ToolbarLayout
42 isSticky
43 className={"pf-v6-u-p-md pf-v6-u-pl-xl"}
44 toolbarItems={props.toolbarItems}
45 />
46 </FlexItem>
47 )}
48 </Flex>
49 </div>
50 );
51 };
52
53 export default TabLayout;