<?php
/**
 * Template part for displaying the site preloader.
 *
 * @package Eronex
 * @since 0.0.1
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$preloader_enable = eronex_option( 'eronex_preloader_enable', false );

if ( ! $preloader_enable ) {
	return;
}

$layout          = eronex_option( 'eronex_preloader_layout', '1' );
$preloader_image = eronex_option( 'eronex_preloader_image', '' );
$timeout         = eronex_option( 'eronex_preloader_timeout', 0.3 );
?>
<div class="eronex-preloader-wrapper eronex-preloader-layout-<?php echo esc_attr( $layout ); ?>" data-preloader-timeout="<?php echo esc_attr($timeout); ?>">
	<div class="eronex-preloader">
		<?php
		if ( 'image' === $layout && ! empty( $preloader_image ) ) {
			?>
            <img class="eronex-preloader-image" src="<?php echo esc_url( $preloader_image ); ?>" alt="<?php echo esc_attr__( 'Preloader', 'eronex' ); ?>">
			<?php
		}
		?>
	</div>
</div>
