94122583ac
新增 PlatformAsyncStatePanel 统一 profile 异步状态骨架 扩展 PlatformSegmentedTabs 支持滚动 tab 并接入创作入口与发现页 统一 PixelCloseButton 复用 PlatformModalCloseButton 像素关闭能力 抽取平台入口泥点前置提示弹层并收紧阻断语义 补充组件收口文档与共享决策记录
38 lines
810 B
TypeScript
38 lines
810 B
TypeScript
import type { ReactNode } from 'react';
|
|
|
|
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}</>;
|
|
}
|