import { athenaConfigOptions } from '../../global/athena-config.js';
import { handleHtml } from '../../global/helpers/athena-global-helper.js';

/**
 * Append or Remove Spinner
 */
function athenaSpinner() {
    if(athenaConfigOptions.showSpinner){
        document.body.classList.add(`spinner-show-${athenaConfigOptions.suffixArea}`);
        athenaConfigOptions.athenaContent.append(
            handleHtml(`
                  <div class="athena-spinner-${athenaConfigOptions.suffixArea}">
                      <div class="ajax-loading">
                           <span class="scroll-ajax-button">
                                <div class="athena-spinner-loader"></div>
                           </span>
                      </div>
                  </div>
            `, `.athena-spinner-${athenaConfigOptions.suffixArea}`)
        );
    } else {
        let spinner = document.querySelector(`.athena-spinner-${athenaConfigOptions.suffixArea}`);
        if(spinner){
            spinner.remove();
            document.body.classList.remove(`spinner-show-${athenaConfigOptions.suffixArea}`);
        }
    }
}


//Exporting all Functions
export {
    athenaSpinner
}