<?php
declare(strict_types=1);

$sliderBlock = \Magento\Framework\App\ObjectManager::getInstance()->get('\Mirasvit\Brand\Block\Widget\BrandSlider')

/** @var \Magento\Framework\Escaper $escaper */
/** @var \Hyva\Theme\Model\ViewModelRegistry $viewModels */
?>
<?php
$isShowBrandLabel = $sliderBlock->isShowBrandLabel();

$containerId = 'mst-brand__slider-' . rand(10000, 100000);

$item = $block->getData('item');
?>

<a href="<?= $sliderBlock->getBrandUrl($item) ?>" class="slide rounded-2xl ">
    <div class="m-slider <?php if ($isShowBrandLabel): ?>m-slider-brand-label<?php endif ?>">
        <?php if ($item['logo']) : ?>
            <img src="<?= $sliderBlock->getImageUrl($item->getLogo()) ?>" loading="lazy" class="rounded-2xl" alt="<?= $escaper->escapeHtml($item->getBrandTitle()) ?> logo" />
        <?php else : ?>
            <p class="m-no-img"><?= $item->getBrandTitle()[0] ?></p>
        <?php endif; ?>
    </div>
</a>
<?php if ($isShowBrandLabel) : ?>
    <div class="py-2 text-center ">
        <a href="<?= $sliderBlock->getBrandUrl($item) ?>" class="text-sm lg:text-base font-medium">
            <?= $escaper->escapeHtml($item->getBrandTitle()) ?>
        </a>
    </div>
<?php endif ?>
