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-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-02 12:50:00 +08:00
|
|
|
{header && <AppPageLayoutHeader variant={headerVariant}>{header}</AppPageLayoutHeader>}
|
|
|
|
<AppPageLayoutContent scrollable={scrollable}>{children}</AppPageLayoutContent>
|
2025-03-01 07:36:40 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|