<?php

use Services\enums\SliderType;
use Services\GeneralService;

/* @var SliderType $banner */
$banner = $args['banner'];

/* @var int $size */
$size = $args['size'];

$general_service = new GeneralService();
$banners         = $general_service->getGridBanner( $banner );
?>

<?php if ( empty( $banners ) || sizeof( $banners ) == 0 ) {
	return;
}

$class = "grid-cols-1";
if($size == "grid")
    $class = "grid-cols-1 sm:grid-cols-2";

?>

<div class="mt-15 container-md">
    <div class="grid gap-6 <?= $class ?>">
		<?php foreach ( $banners as $banner ) { ?>
            <a class="col-span-1 rounded-2xl overflow-hidden" href="<?= $banner->link ?>">
                <img class="w-full" src="<?= $banner->image->src ?>" alt="<?= $banner->image->alt ?>"/>
            </a>
		<?php } ?>
    </div>
</div>