<?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\View;
use Magento\Framework\Escaper;

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

$_post = $block->getPost();
$_postUrl = $_post->getPostUrl();
$_postName = $escaper->escapeHtml($_post->getTitle(), null);
?>

<div class="post-view">
    <div class="post-holder post-holder-<?= (int)$_post->getId() ?>">
        <div class="post-header clearfix mb-4">
            <?= $block->getInfoHtml() ?>
        </div>

        <div class="post-content">
            <div class="post-description clearfix">
                <?php if ($featuredImage = $_post->getFeaturedImage()): ?>
                    <?php $featuredImgAlt = $_post->getData('featured_img_alt'); ?>
                    <?php if (!$featuredImgAlt): ?>
                        <?php $featuredImgAlt = $_postName; ?>
                    <?php endif ?>

                    <div class="post-ftimg-hld">
                        <img src="<?= $escaper->escapeUrl($featuredImage) ?>"
                             alt="<?= $escaper->escapeHtmlAttr($featuredImgAlt) ?>"
                             class="w-full"
                             loading="lazy" />
                    </div>
                <?php endif; ?>

                <div class="post-text-hld">
                    <?= /*@noEscape*/ $block->getContent() ?>
                </div>
            </div>
        </div>

        <div class="post-bottom">
            <?= $block->getChildHtml('blog.post.bottom') ?>
        </div>
    </div>
</div>
