<?php
/**
 * Hyvä Themes - https://hyva.io
 * Copyright © Hyvä Themes 2020-present. All rights reserved.
 * This product is licensed per Magento install
 * See https://hyva.io/license
 */

declare(strict_types=1);

use Magento\Catalog\Block\Product\ProductList\Toolbar;
use Magento\Framework\Escaper;

/** @var Toolbar $block */
/** @var Escaper $escaper */


$availableLimitOptions = $block->getAvailableLimit();

?>

<?php if (count($availableLimitOptions) > 1): ?>
    <div class="field limiter flex items-center order-2 md:w-1/3 md:text-center md:justify-center">
        <div class="control">
            <label class="text-sm mr-2 label">
                <span class="text-center text-base leading-4 tracking-custom3 pr-5"><?= $escaper->escapeHtml((string)__('Show')) ?></span>
                <?php foreach ($block->getAvailableLimit() as $_key => $_limit):
                    if ($block->isLimitCurrent($_key)) : ?>
                        <span class="text-black font-bold text-base  leading-4 tracking-custom3 pr-5">
                            <?php /* @escapeNotVerified */ echo $_limit ?>
                        </span>
                    <?php else : ?>
                        <a class="text-black text-base  leading-4 tracking-custom3 pr-5" data-role="limiter" href="#" @click.prevent="changeUrl('product_list_limit', <?= $_key ?>, options.limitDefault)" data-value="<?= $_key ?>">
                            <?php /* @escapeNotVerified */ echo $_limit ?>
                        </a>
                    <?php endif ?>
                <?php endforeach; ?>
            </label>
        </div>
        <span class="limiter-text text-sm ml-2 sr-only">
        <?= $escaper->escapeHtml(__('per page')) ?>
    </span>
    </div>
<?php else: ?>
    <div class="field limiter flex order-3 sm:order-2 md:order-3 lg:order-2 col-span-2 justify-end">

    </div>
<?php endif;
