Files
Genarrative/src/components/auth/PlatformAuthModalShell.tsx
T
kdletters 071faa482c 统一 Rust 与 TypeScript 格式化门禁
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口

完成项目 TypeScript/Prettier 与 Rust 全量格式化

修复 Pingora expected executable 门禁的空白敏感误报

同步开发运维文档与 AGC skill pack 格式化忽略规则
2026-09-01 16:28:34 +08:00

80 lines
2.2 KiB
TypeScript

import type { CSSProperties, ReactNode } from 'react';
import type { PlatformTheme } from '../../../packages/shared/src/contracts/runtime';
import { UnifiedModal } from '../common/UnifiedModal';
type PlatformAuthModalShellProps = {
title: string;
platformTheme: PlatformTheme;
onClose: () => void;
children: ReactNode;
closeLabel: string;
size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';
showHeader?: boolean;
overlaySpacing?: 'default' | 'none';
zIndexClassName?: string;
overlayClassName?: string;
overlayStyle?: CSSProperties;
authCardClassName?: string;
panelClassName?: string;
bodyClassName?: string;
panelStyle?: CSSProperties;
};
function joinClassNames(
...classNames: Array<string | false | null | undefined>
) {
return classNames.filter(Boolean).join(' ');
}
/**
* 认证入口弹窗共享壳层。
* 这里只统一主题遮罩、auth card、标题栏和关闭按钮,登录 / 邀请码表单状态仍留在各自业务组件。
*/
export function PlatformAuthModalShell({
title,
platformTheme,
onClose,
children,
closeLabel,
size = 'sm',
showHeader = true,
overlaySpacing = 'default',
zIndexClassName = 'z-[120]',
overlayClassName,
overlayStyle,
authCardClassName = 'platform-auth-card !rounded-[2rem] sm:!rounded-[2rem]',
panelClassName,
bodyClassName = '!p-0',
panelStyle,
}: PlatformAuthModalShellProps) {
return (
<UnifiedModal
open
title={title}
onClose={onClose}
closeLabel={closeLabel}
closeVariant="platformIcon"
closeOnBackdrop
closeOnEscape={false}
size={size}
showHeader={showHeader}
portalTheme={platformTheme}
zIndexClassName={zIndexClassName}
overlayClassName={joinClassNames(
'text-[var(--platform-text-strong)]',
overlaySpacing === 'default' && '!px-3 !py-4 sm:!p-4',
overlayClassName,
)}
overlayStyle={overlayStyle}
panelClassName={joinClassNames(authCardClassName, panelClassName)}
headerClassName="!items-center !px-5 !py-4"
titleClassName="text-lg font-semibold text-[var(--platform-text-strong)]"
bodyClassName={bodyClassName}
panelStyle={panelStyle}
>
{children}
</UnifiedModal>
);
}