Files
blitzkit/src/components/PageWrapper.tsx
T

53 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-04-01 18:36:14 -05:00
import { Flex, FlexProps, Theme } from '@radix-ui/themes';
2023-09-18 22:32:21 +00:00
import { ComponentProps } from 'react';
2024-05-04 13:46:57 -05:00
import { theme } from '../stitches.config';
2023-09-18 21:55:40 +00:00
2024-04-01 18:36:14 -05:00
type PageWrapperProps = FlexProps & {
2023-11-07 10:06:15 -06:00
color?: ComponentProps<typeof Theme>['accentColor'];
2024-04-04 11:04:27 -05:00
size?: number | string;
2024-05-03 12:57:04 -05:00
noPadding?: boolean;
noMaxWidth?: boolean;
2024-05-04 13:46:57 -05:00
highlight?: boolean;
2024-04-01 18:36:14 -05:00
};
2023-11-07 10:06:15 -06:00
2023-09-18 22:32:21 +00:00
export default function PageWrapper({
style,
2023-11-07 10:06:15 -06:00
color,
2024-03-31 22:27:11 -05:00
size = 800,
2024-04-18 19:11:50 -05:00
children,
2024-05-03 12:57:04 -05:00
noPadding = false,
noMaxWidth = false,
2024-05-04 13:46:57 -05:00
highlight = false,
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-04-06 12:49:38 -05:00
<Theme
accentColor={color}
style={{
flex: 1,
display: 'flex',
flexDirection: 'column',
2024-05-04 13:46:57 -05:00
background: highlight
? `linear-gradient(-90deg, ${theme.colors.appBackground1}, ${theme.colors.appBackground2})`
: undefined,
2024-04-06 12:49:38 -05:00
}}
>
2023-11-07 17:33:41 -06:00
<Flex
direction="column"
gap="4"
2023-11-07 10:06:15 -06:00
style={{
width: '100%',
2024-05-03 12:57:04 -05:00
maxWidth: noMaxWidth ? undefined : size,
2023-11-07 10:06:15 -06:00
margin: 'auto',
2024-05-03 12:57:04 -05:00
padding: noPadding ? 0 : 16,
2023-11-07 10:06:15 -06:00
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>
2023-11-07 10:06:15 -06:00
</Theme>
2023-09-18 21:55:40 +00:00
);
}