import React, { type ComponentPropsWithoutRef, type FC, type ReactNode } from 'react'; import { useDebounce } from '@wener/reaction'; import { cn } from '../../utils/cn'; import { ErrorPlaceholder } from './ErrorPlaceholder'; export const NotReadyPlaceholder: FC< { loading?: boolean; error?: any; content?: ReactNode; refetch?: () => void; empty?: boolean | number; } & Omit, 'content'> > = ({ loading, refetch, empty, children, error, className, content = children, ...props }) => { // 200-500ms const _loading = useDebounce(loading, 250); if (_loading) { return (
); } if (error) { return ; } if (empty !== undefined && !empty) { return (
没有数据
); } return content; };