import type { ReactNode } from 'react'; export type PlatformAsyncStatePanelProps = { errorState?: ReactNode; isLoading?: boolean; loadingState?: ReactNode; isEmpty?: boolean; emptyState?: ReactNode; children: ReactNode; }; /** * 平台异步状态面板骨架。 * 只负责在错误、读取、空态和内容之间切换,具体文案与外观继续交给调用方传入 slot。 */ export function PlatformAsyncStatePanel({ errorState, isLoading = false, loadingState = null, isEmpty = false, emptyState = null, children, }: PlatformAsyncStatePanelProps) { if (errorState !== undefined && errorState !== null) { return <>{errorState}; } if (isLoading) { return <>{loadingState}; } if (isEmpty) { return <>{emptyState}; } return <>{children}; }