import { UnityAction } from '@/utils/utils';
import { CloseOutlined } from '@ant-design/icons';
import { ConfigProvider } from 'antd';
import locale from 'antd/es/locale/zh_CN';
import styles from './index.less';

export default (props) => {
  const { children, style, closeable = true, tabs = false } = props;

  const handleClose = () => {
    UnityAction.sendMsg('closePage');
  };

  return (
    <ConfigProvider locale={locale}>
      <div className={styles.page} style={style}>
        {closeable && (
          <CloseOutlined
            onClick={handleClose}
            className={styles.close}
            style={{ top: tabs ? 65 : '' }}
          />
        )}

        {children}
      </div>
    </ConfigProvider>
  );
};
