weaver_trunk_cli/pc4mobx/hrm/public/valhalla/components/CenterSpin.js

39 lines
600 B
JavaScript

import {
Spin
} from 'antd';
export default class CenterSpin extends React.Component {
render() {
const {
loading,
size,
} = this.props;
const style = {
position: 'absolute',
top: '50%',
left: '50%',
marginLeft: -8,
marginTop: -8,
}
if (size === 'large') {
Object.assign(style, {
marginLeft: -16,
marginTop: -16,
});
}
if (loading) {
return (
<div style={style}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@i3orth`} spinning={true} size={size} />
</div>
)
}else{
return this.props.children
}
}
}