blob: f07e589ba348e2918e9dc524214e7257f060e2ac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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>
);
}
|