import React,{Component} from 'react';
import {Spin} from "antd";

class SpinContainer extends Component{
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <div style={{position:'relative'}}>
                {this.props.children}
                {this.props.spinning ? <div style={{
                    position: 'absolute',
                    top: '0px',
                    bottom: '0px',
                    left: '0px',
                    right: '0px',
                    display: 'flex',
                    alignItems: 'center',
                    justifyContent: 'center',
                    background: 'rgb(255, 255, 255,.3)',
                }}>
                    <Spin className={this.props.className} spinning={this.props.spinning}/>
                </div> : null}
            </div>
        )
    }
}

export default SpinContainer;
