<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) 2021 Amasty (https://www.amasty.com)
 * @package Amasty_AdvancedReview
 */
?>
<?php
/** @var \Amasty\AdvancedReview\Block\Images $block */
$collection = $block->getCollection();
?>

<?php if ($collection->getSize()): ?>
    <div id="amreview-id-<?= /* @noEscape */ $block->getReviewId() ?>"
         class="amreview-images <?= /* @noEscape */ $collection->getSize() >= 3 ? '-slider' : '' ?>"
         data-amreview-js="review-images">
        <?php foreach ($collection as $item): ?>
            <div class="amreview-slider-item" data-amreview-js="slider-item">
                <a href="<?= $block->escapeHtml($block->getFullImagePath($item)) ?>"
                   class="amreview-image-link fancybox"
                   data-fancybox="amreview-image-group-<?= /* @noEscape */ $block->getReviewId() ?>">
                    <img class="amreview-image"
                         src="<?= /* @noEscape */ $block->getResizedImagePath($item);?>"
                         title="<?= $block->escapeHtml(__('Review image')); ?>"
                         alt="<?= $block->escapeHtml(__('Review image')); ?>"
                    />
                </a>
            </div>
        <?php endforeach; ?>
    </div>

    <?php if ($block->getAddSizeStyles()): ?>
        <style>
            .amreview-slider-item {
                max-width: <?= /* @noEscape */ (int)$block->getMaxHeight();?>px;
                max-height: <?= /* @noEscape */ (int)$block->getMaxHeight();?>px;
            }

            .amreview-images.slick-slider {
                max-width: <?= /* @noEscape */ ((int)$block->getMaxHeight() + 10) * $block->getSlidesToShow() + 40;?>px;
            }
        </style>
    <?php endif;?>
<?php endif;?>
