<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Blog Pro for Magento 2
 */
/** @var \Amasty\Blog\Block\Content\Post\Details $block */
/** @var \Magento\Framework\Escaper $escaper */

$post = $block->getPost();
$viewModel = $block->getViewModel();
?>

<?php if ($block->isShowAuthorInfo() && $post->getPostedBy()): ?>
    <?php $smallAuthorImage = $viewModel->getImage($post->getAuthor()); ?>
    <div class="amblog-wrap">
        <?php if ($smallAuthorImage): ?>
        <figure class="amblog-author-avatar -small">
            <img width="25"
                 height="25"
                 src="<?= $escaper->escapeUrl($smallAuthorImage); ?>"
                 alt="<?= $escaper->escapeHtmlAttr($post->getPostedBy()); ?>" />
        </figure>
        <?php else: ?>
            <svg class="amblog-svg user <?= $escaper->escapeHtmlAttr($block->getColorClass()); ?>">
                <use xlink:href="<?= $escaper->escapeUrl($block->getViewFileUrl('Amasty_Blog::images/sprite.svg')); ?>#user"></use>
            </svg>
        <?php endif; ?>
        <div class="amblog-post-item -author">
            <?= $escaper->escapeHtml(__('by ')); ?>
            <a rel="author"
               class="amblog-ref"
               href="<?= $escaper->escapeUrl($post->getAuthor()->getUrl()); ?>"
               title="<?= $escaper->escapeHtmlAttr($post->getPostedBy()); ?>"
               aria-label="<?= $escaper->escapeHtmlAttr($post->getPostedBy()); ?>">
                <?= $escaper->escapeHtml($post->getPostedBy()); ?>
            </a>
        </div>
    </div>
<?php endif; ?>
