buster/web/src/components/ui/layouts/AppPageLayout.tsx

46 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-03-01 07:36:40 +08:00
import React from 'react';
2025-03-01 08:11:40 +08:00
import { cn } from '@/lib/utils';
2025-03-02 12:50:00 +08:00
import { AppPageLayoutHeader } from './AppPageLayoutHeader';
import { AppPageLayoutContent } from './AppPageLayoutContent';
2025-03-01 07:36:40 +08:00
/**
* @param header - Header content at the top of the page
* @param floating - Applies floating styles (default: true)
* @param scrollable - Makes content scrollable (default: true)
* @param className - Additional CSS classes
* @param children - Page content
* @internal
*/
2025-03-01 07:42:58 +08:00
export const AppPageLayout: React.FC<
2025-03-01 07:36:40 +08:00
React.PropsWithChildren<{
header?: React.ReactNode;
scrollable?: boolean;
className?: string;
2025-03-05 04:52:33 +08:00
headerSizeVariant?: 'default' | 'list';
headerBorderVariant?: 'default' | 'ghost';
2025-03-01 07:36:40 +08:00
}>
2025-03-05 04:52:33 +08:00
> = ({
children,
header,
scrollable = false,
className = '',
headerSizeVariant = 'default',
headerBorderVariant = 'default'
}) => {
2025-03-01 07:36:40 +08:00
return (
<div
className={cn(
2025-03-01 07:42:58 +08:00
'flex h-full w-full flex-col overflow-hidden',
scrollable && 'overflow-y-auto',
2025-03-01 07:36:40 +08:00
className
)}>
2025-03-05 04:52:33 +08:00
{header && (
<AppPageLayoutHeader sizeVariant={headerSizeVariant} borderVariant={headerBorderVariant}>
{header}
</AppPageLayoutHeader>
)}
2025-03-02 12:50:00 +08:00
<AppPageLayoutContent scrollable={scrollable}>{children}</AppPageLayoutContent>
2025-03-01 07:36:40 +08:00
</div>
);
};