import { Button, Link, Stack, Typography } from '@mui/material'; import type { LiteralUnion } from 'type-fest'; type ModeType = LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>; type Props = { title: string; description: string; button?: string | React.ReactNode; mode?: ModeType; }; function getHeightStyle(mode: ModeType | undefined): any { switch (mode) { case 'standalone': return { height: '100vh', maxHeight: '100%' }; // 独立模式下,高度为100vh default: return { height: 'auto', minHeight: 200 }; // 默认情况下,高度根据内容自动调整 } } export default function PaymentError({ title, description, button = 'Back', mode = 'standalone' }: Props) { const heightStyle = getHeightStyle(mode); return ( {title} {description} {typeof button === 'string' ? ( ) : ( button )} ); }