import React, { FunctionComponent } from 'react';
import { Spin } from 'antd';
import './JFLoading.scss';

interface JFLoadingProps {
    mask?: boolean,
    loading?: boolean
}

export const JFLoading: FunctionComponent<JFLoadingProps> = ({loading = false, mask = false}) => {
    if (!loading) {
        return null;
    }

    return (
        <div className={`jf-loading${mask ? ' mask' : ''}`}>
            <Spin size="large" />
        </div>
    )
}
