import React from 'react';
import { Spin } from '@easyv/antd';
import { LoadingOutlined } from '@ant-design/icons';

function EasyvSpin({ children, loading = true }: { loading?: boolean; children?: React.ReactNode }): React.ReactElement {
  const antIcon = <LoadingOutlined spin />;

  return (
    <Spin spinning={loading} indicator={antIcon}>
      {children}
    </Spin>
  );
}

export default EasyvSpin;
