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

34 lines
1.1 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-01 07:36:40 +08:00
import { AppContentHeader } from './AppContentHeader';
import { AppContentPage } from './AppContentPage';
/**
* @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-01 07:42:58 +08:00
headerVariant?: 'default' | 'list';
2025-03-01 07:36:40 +08:00
}>
2025-03-01 08:11:40 +08:00
> = ({ children, header, scrollable = false, className = '', headerVariant = '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-01 07:42:58 +08:00
{header && <AppContentHeader variant={headerVariant}>{header}</AppContentHeader>}
<AppContentPage scrollable={scrollable}>{children}</AppContentPage>
2025-03-01 07:36:40 +08:00
</div>
);
};