<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Blog Pro for Magento 2
 */
/** @var \Amasty\Blog\Block\Sidebar\Recentcomments $block */

$collection = $block->getCommentsCollection();
?>

<?php if ($collection && $collection->getSize()): ?>
    <div class="amblog-recentcomments sidebar-item">
        <div class="amblog-amp-title">
            <?= $block->escapeHtml($block->getBlockHeader()); ?>
        </div>
        <?php foreach ($collection as $comment): ?>
            <div class="amblog-recent-comment item">
                <a class="amblog-sidebar-message" href="<?= $block->escapeUrl($comment->getUrl()); ?>">
                    <?= $block->escapeHtml($comment->getMessage()); ?>
                </a>
                <?php if ($block->needShowDate()): ?>
                    <div class="amblog-sidebar-date">
                        <?= /* @noEscape */ $block->renderDate($comment->getCreatedAt()); ?>
                    </div>
                <?php endif; ?>
                <?php if ($block->needShowThesis()): ?>
                    <div class="amblog-comment-thesis">
                        <?= /* @noEscape */ $block->getStrippedContent($comment->getMessage()); ?>
                    </div>
                <?php endif; ?>
            </div>
        <?php endforeach; ?>
    </div>
<?php endif; ?>
