aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/PageBody.tsx
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-24 13:09:50 +0000
committerFuwn <[email protected]>2026-01-24 13:09:50 +0000
commit396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch)
treeb9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /src/components/common/PageBody.tsx
downloadumami-396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b.tar.xz
umami-396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b.zip
Initial commitHEADmain
Created from https://vercel.com/new
Diffstat (limited to 'src/components/common/PageBody.tsx')
-rw-r--r--src/components/common/PageBody.tsx42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/components/common/PageBody.tsx b/src/components/common/PageBody.tsx
new file mode 100644
index 0000000..f07e589
--- /dev/null
+++ b/src/components/common/PageBody.tsx
@@ -0,0 +1,42 @@
+'use client';
+import { AlertBanner, Column, type ColumnProps, Loading } from '@umami/react-zen';
+import type { ReactNode } from 'react';
+import { useMessages } from '@/components/hooks';
+
+const DEFAULT_WIDTH = '1320px';
+
+export function PageBody({
+ maxWidth = DEFAULT_WIDTH,
+ error,
+ isLoading,
+ children,
+ ...props
+}: {
+ maxWidth?: string;
+ error?: unknown;
+ isLoading?: boolean;
+ children?: ReactNode;
+} & ColumnProps) {
+ const { formatMessage, messages } = useMessages();
+
+ if (error) {
+ return <AlertBanner title={formatMessage(messages.error)} variant="error" />;
+ }
+
+ if (isLoading) {
+ return <Loading placement="absolute" />;
+ }
+
+ return (
+ <Column
+ {...props}
+ width="100%"
+ paddingBottom="6"
+ maxWidth={maxWidth}
+ paddingX={{ xs: '3', md: '6' }}
+ style={{ margin: '0 auto' }}
+ >
+ {children}
+ </Column>
+ );
+}