Files
Genarrative/src/components/auth/PlatformAuthModalShell.tsx
T
k88936 bd4baf66b1
Project CI / Repository checks (pull_request) Successful in 1m18s
Project CI / Backend tests (pull_request) Successful in 3m59s
Project CI / Native shell tests (pull_request) Successful in 10m52s
Project CI / Frontend tests (pull_request) Successful in 4m19s
统一修复Modal Portal主题继承
在UnifiedModal集中解析Portal主题并支持显式覆盖
梳理危险确认、图片预览、报告和工具弹窗的主题边界
修复固定浅色画布弹窗与Agent菜单的主题回归
将相关公共组件测试纳入默认Vitest收集范围
同步Platform UI Kit、画布Agent与共享记忆文档
2026-07-31 20:14:58 +08:00

81 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>
);
}