Files
Genarrative/src/components/common/PlatformToolModalShell.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

88 lines
2.3 KiB
TypeScript

import type { ReactNode } from 'react';
import { UnifiedModal } from './UnifiedModal';
type PlatformToolModalShellProps = {
open: boolean;
title: string;
ariaLabel?: string;
description?: ReactNode;
children: ReactNode;
footer?: ReactNode;
onClose: () => void;
size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';
closeLabel?: string;
closeDisabled?: boolean;
closeOnBackdrop?: boolean;
closeOnEscape?: boolean;
zIndexClassName?: string;
panelClassName?: string;
titleClassName?: string;
bodyClassName?: string;
footerClassName?: string;
};
function joinClassNames(
...classNames: Array<string | false | null | undefined>
) {
return classNames.filter(Boolean).join(' ');
}
/**
* 结果页 / 工具页里的白底 portal 弹窗壳。
* 这里只收口平台主题 overlay、白底 panel 和标准 header/body/footer 节奏,不吸收各玩法正文与动作语义。
*/
export function PlatformToolModalShell({
open,
title,
ariaLabel,
description,
children,
footer,
onClose,
size = 'xl',
closeLabel,
closeDisabled = false,
closeOnBackdrop = true,
closeOnEscape = true,
zIndexClassName = 'z-[140]',
panelClassName,
titleClassName,
bodyClassName,
footerClassName,
}: PlatformToolModalShellProps) {
return (
<UnifiedModal
open={open}
title={title}
// 某些工具弹窗标题会直接显示当前关卡/物品名,但读屏和测试更适合使用稳定的弹窗语义名。
ariaLabel={ariaLabel}
description={description}
onClose={onClose}
footer={footer}
size={size}
closeLabel={closeLabel ?? `关闭${ariaLabel ?? title}`}
closeDisabled={closeDisabled}
closeOnBackdrop={closeOnBackdrop}
closeOnEscape={closeOnEscape}
zIndexClassName={zIndexClassName}
panelClassName={joinClassNames(
'platform-remap-surface shadow-[0_24px_80px_rgba(0,0,0,0.55)]',
panelClassName,
)}
headerClassName="!items-center !px-5 !py-4"
titleClassName={titleClassName}
bodyClassName={joinClassNames(
'!px-5 !py-4 sm:!px-5 sm:!py-4',
bodyClassName,
)}
footerClassName={joinClassNames(
'!px-5 !py-4 sm:!px-5 sm:!py-4',
footerClassName,
)}
>
{children}
</UnifiedModal>
);
}