2025-09-18 10:43:38 -05:00
|
|
|
import { Flex, type FlexProps, Theme } from "@radix-ui/themes";
|
|
|
|
|
import type { ComponentProps } from "react";
|
|
|
|
|
import { NAVBAR_HEIGHT } from "../constants/navbar";
|
|
|
|
|
import type { RadixSize } from "../stores/embedState";
|
|
|
|
|
import { BlitzKitTheme } from "./BlitzKitTheme";
|
2023-09-18 21:55:40 +00:00
|
|
|
|
2024-04-01 18:36:14 -05:00
|
|
|
type PageWrapperProps = FlexProps & {
|
2025-09-18 10:43:38 -05:00
|
|
|
color?: ComponentProps<typeof Theme>["accentColor"];
|
2024-05-04 16:19:27 -05:00
|
|
|
containerProps?: ComponentProps<typeof Theme>;
|
2024-05-04 16:39:41 -05:00
|
|
|
noFlex1?: boolean;
|
2024-08-06 14:05:16 -05:00
|
|
|
padding?: RadixSize;
|
2024-10-09 19:40:55 -05:00
|
|
|
noMinHeight?: boolean;
|
2024-04-01 18:36:14 -05:00
|
|
|
};
|
2023-11-07 10:06:15 -06:00
|
|
|
|
2024-09-08 10:11:24 -05:00
|
|
|
export function PageWrapper({
|
2023-09-18 22:32:21 +00:00
|
|
|
style,
|
2023-11-07 10:06:15 -06:00
|
|
|
color,
|
2024-04-18 19:11:50 -05:00
|
|
|
children,
|
2024-05-04 16:39:41 -05:00
|
|
|
noFlex1 = false,
|
2024-05-04 16:19:27 -05:00
|
|
|
containerProps,
|
2024-10-09 19:40:55 -05:00
|
|
|
noMinHeight = false,
|
2025-09-18 10:43:38 -05:00
|
|
|
padding = "4",
|
2023-09-18 22:32:21 +00:00
|
|
|
...props
|
2023-11-07 10:06:15 -06:00
|
|
|
}: PageWrapperProps) {
|
2023-09-18 21:55:40 +00:00
|
|
|
return (
|
2024-09-21 12:16:51 -05:00
|
|
|
<BlitzKitTheme
|
2024-04-06 12:49:38 -05:00
|
|
|
accentColor={color}
|
|
|
|
|
style={{
|
2024-05-04 16:39:41 -05:00
|
|
|
flex: noFlex1 ? undefined : 1,
|
2025-09-18 10:43:38 -05:00
|
|
|
display: "flex",
|
|
|
|
|
minHeight: noMinHeight ? "unset" : `calc(100svh - ${NAVBAR_HEIGHT}px)`,
|
|
|
|
|
flexDirection: "column",
|
2024-05-04 16:19:27 -05:00
|
|
|
...containerProps?.style,
|
2024-04-06 12:49:38 -05:00
|
|
|
}}
|
2024-05-20 14:16:13 -05:00
|
|
|
{...containerProps}
|
2024-04-06 12:49:38 -05:00
|
|
|
>
|
2023-11-07 17:33:41 -06:00
|
|
|
<Flex
|
|
|
|
|
direction="column"
|
|
|
|
|
gap="4"
|
2024-08-06 14:05:16 -05:00
|
|
|
p={padding}
|
2024-11-24 20:03:10 -06:00
|
|
|
width="100%"
|
2025-04-03 12:15:08 -05:00
|
|
|
maxWidth="80rem"
|
2023-11-07 10:06:15 -06:00
|
|
|
style={{
|
2025-09-18 10:43:38 -05:00
|
|
|
margin: "auto",
|
|
|
|
|
boxSizing: "border-box",
|
2024-04-06 12:49:38 -05:00
|
|
|
flex: 1,
|
2023-11-07 10:06:15 -06:00
|
|
|
...style,
|
|
|
|
|
}}
|
2023-12-01 12:23:17 -06:00
|
|
|
{...props}
|
2024-04-18 19:11:50 -05:00
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</Flex>
|
2024-09-21 12:16:51 -05:00
|
|
|
</BlitzKitTheme>
|
2023-09-18 21:55:40 +00:00
|
|
|
);
|
|
|
|
|
}
|