<?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
 */

use Magefan\Blog\Block\Post\PostList;
use Magento\Framework\Escaper;

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

$_postCollection = $block->getPostCollection();
?>

<?php if (!$_postCollection->count()): ?>
    <div class="message info empty">
        <div>
            <?= $escaper->escapeHtml(__('We can\'t find posts matching the selection.')) ?>
        </div>
    </div>
<?php else: ?>
    <?= $block->getAdditionalHtml() ?>
    <div class="post-list-wrapper">
        <?php $iterator = 1; ?>
        <ol class="post-list grid gap-2 grid-cols-1 md:gap-4 md:grid-cols-2 lg:grid-cols-3 -mx-4">
            <?php foreach ($_postCollection as $_post): ?>
                <?= $block->getPostHtml($_post) ?>
            <?php endforeach; ?>
            <li class="hidden">
                <script type="text/javascript">
                    if (window.addthis) {
                        addthis.toolbox('.addthis_toolbox');
                    }
                </script>
            </li>
        </ol>
    </div>

    <?= $block->getToolbarHtml() ?>
    <?= $block->getChildHtml('addthisJs'); ?>
<?php endif; ?>
