import { Spin, Typography, Space, SyncOutlined, Text, FC } from '@/imports';

interface LoadingStateProps {
  size?: 'small' | 'default' | 'large';
  tip?: string;
  fullScreen?: boolean;
}

export const LoadingState: FC<LoadingStateProps> = ({
  size = 'default',
  tip = '加载中...',
  fullScreen = false,
}) => {
  if (fullScreen) {
    return (
      <div style={{
        display: 'flex',
        flexDirection: 'column',
        justifyContent: 'center',
        alignItems: 'center',
        minHeight: '100vh',
        padding: '20px',
      }}>
        <Space direction="vertical" align="center">
          <Spin size={size} indicator={<SyncOutlined spin />} />
          <Text>{tip}</Text>
        </Space>
      </div>
    );
  }

  return (
    <div style={{
      display: 'flex',
      flexDirection: 'column',
      justifyContent: 'center',
      alignItems: 'center',
      padding: '40px 20px',
    }}>
      <Space direction="vertical" align="center">
        <Spin size={size} indicator={<SyncOutlined spin />} />
        <Text>{tip}</Text>
      </Space>
    </div>
  );
};

export default LoadingState;