Skip to content

Commit

Permalink
feat: emui centered layout (#2070)
Browse files Browse the repository at this point in the history
## Description:
This PR implements main app centering, whilst maintaining `maxWidth:
1440px` per the mocks.

[Screencast from 22-01-24
17:25:05.webm](https://github.com/kurtosis-tech/kurtosis/assets/4419574/dcc3fe9d-3c63-4116-be56-8f66605b822f)

## Is this change user facing?
YES

## References (if applicable):
* Fixes #2061
  • Loading branch information
Dartoxian committed Jan 24, 2024
1 parent d389763 commit 3cf2f59
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions enclave-manager/web/packages/components/src/AppLayout.tsx
Expand Up @@ -42,7 +42,13 @@ export const AppPageLayout = ({ preventPageScroll, children }: AppPageLayoutProp

if (numberOfChildren === 1) {
return (
<Box w={"100%"} h={preventPageScroll ? `100vh` : "100%"} flex={"1"}>
<Flex
w={"100%"}
h={preventPageScroll ? `100vh` : "100%"}
flex={"1"}
justifyContent={"center"}
alignItems={"center"}
>
<Flex
position={"absolute"}
top={"0"}
Expand All @@ -68,15 +74,15 @@ export const AppPageLayout = ({ preventPageScroll, children }: AppPageLayoutProp
{children}
</Flex>
</Flex>
</Box>
</Flex>
);
}

// TS cannot infer that children is an array if numberOfChildren === 2
if (numberOfChildren === 2 && Array.isArray(children)) {
return (
<Flex flexDirection={"column"} width={"100%"} h={preventPageScroll ? `100vh` : "100%"} flex={"1"}>
<Box width={"100%"} bg={"gray.850"}>
<Flex width={"100%"} bg={"gray.850"} justifyContent={"center"}>
<Box
width={"100%"}
pl={hasNavbar ? MAIN_APP_LEFT_PADDING_WITH_NAV : MAIN_APP_LEFT_PADDING_WITHOUT_NAV}
Expand All @@ -86,20 +92,21 @@ export const AppPageLayout = ({ preventPageScroll, children }: AppPageLayoutProp
<KurtosisBreadcrumbs />
{children[0]}
</Box>
</Box>
<Flex
maxWidth={MAIN_APP_MAX_WIDTH}
pl={hasNavbar ? MAIN_APP_LEFT_PADDING_WITH_NAV : MAIN_APP_LEFT_PADDING_WITHOUT_NAV}
pr={MAIN_APP_RIGHT_PADDING}
pt={MAIN_APP_TOP_PADDING}
pb={MAIN_APP_BOTTOM_PADDING}
w={"100%"}
h={"100%"}
flex={"1"}
flexDirection={"column"}
minH={preventPageScroll ? "0" : undefined}
>
{children[1]}
</Flex>
<Flex h={"100%"} flex={"1"} flexDirection={"column"} alignItems={"center"}>
<Flex
maxWidth={MAIN_APP_MAX_WIDTH}
pl={hasNavbar ? MAIN_APP_LEFT_PADDING_WITH_NAV : MAIN_APP_LEFT_PADDING_WITHOUT_NAV}
pr={MAIN_APP_RIGHT_PADDING}
pt={MAIN_APP_TOP_PADDING}
pb={MAIN_APP_BOTTOM_PADDING}
w={"100%"}
flexDirection={"column"}
minH={preventPageScroll ? "0" : undefined}
flex={"1"}
>
{children[1]}
</Flex>
</Flex>
</Flex>
);
Expand Down

0 comments on commit 3cf2f59

Please sign in to comment.