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-12 06:06:21 +08:00
|
|
|
headerClassName?: string;
|
2025-03-28 05:36:14 +08:00
|
|
|
mainClassName?: string;
|
2025-03-01 07:36:40 +08:00
|
|
|
}>
|
2025-03-05 04:52:33 +08:00
|
|
|
> = ({
|
|
|
|
children,
|
|
|
|
header,
|
|
|
|
scrollable = false,
|
|
|
|
className = '',
|
|
|
|
headerSizeVariant = 'default',
|
2025-03-12 06:06:21 +08:00
|
|
|
headerBorderVariant = 'default',
|
2025-03-28 05:36:14 +08:00
|
|
|
headerClassName = '',
|
|
|
|
mainClassName = ''
|
2025-03-05 04:52:33 +08:00
|
|
|
}) => {
|
2025-03-01 07:36:40 +08:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={cn(
|
2025-03-25 02:31:52 +08:00
|
|
|
'app-page-layout flex h-full w-full flex-col overflow-hidden',
|
2025-03-01 07:42:58 +08:00
|
|
|
scrollable && 'overflow-y-auto',
|
2025-03-01 07:36:40 +08:00
|
|
|
className
|
|
|
|
)}>
|
2025-03-05 04:52:33 +08:00
|
|
|
{header && (
|
2025-03-12 06:06:21 +08:00
|
|
|
<AppPageLayoutHeader
|
2025-03-29 03:42:25 +08:00
|
|
|
className={cn(
|
|
|
|
headerBorderVariant === 'ghost' && 'relative z-10 -mt-[1px]',
|
|
|
|
headerClassName
|
|
|
|
)}
|
2025-03-12 06:06:21 +08:00
|
|
|
sizeVariant={headerSizeVariant}
|
|
|
|
borderVariant={headerBorderVariant}>
|
2025-03-05 04:52:33 +08:00
|
|
|
{header}
|
|
|
|
</AppPageLayoutHeader>
|
|
|
|
)}
|
2025-03-12 04:02:29 +08:00
|
|
|
|
2025-03-25 01:25:34 +08:00
|
|
|
<AppPageLayoutContent
|
2025-03-28 05:36:14 +08:00
|
|
|
className={cn(headerBorderVariant === 'ghost' && 'scroll-shadow-container', mainClassName)}
|
2025-03-25 01:25:34 +08:00
|
|
|
scrollable={scrollable}>
|
2025-03-12 04:02:29 +08:00
|
|
|
{header && scrollable && headerBorderVariant === 'ghost' && (
|
|
|
|
<div className="scroll-header"></div>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{children}
|
|
|
|
</AppPageLayoutContent>
|
2025-03-01 07:36:40 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|