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

/** @var Escaper $escaper */
/** @var NextPrev $block */
?>

<?php if ($block->displayLinks()): ?>
    <?php
        $prevPost = $block->getPrevPost();
        $nextPost = $block->getNextPost();
    ?>
    <?php if ($prevPost || $nextPost): ?>
        <div class=" border-t border-container pt-8">
            <div class="flex justify-between items-center">
                <?php if ($prevPost): ?>
                    <a class="btn btn-primary"
                       href="<?= $escaper->escapeUrl($prevPost->getPostUrl()) ?>"
                       title="<?= $escaper->escapeHtmlAttr(__('Read %1', $prevPost->getTitle())) ?>">
                        <?= $escaper->escapeHtml(__('&larr; Previous')) ?>
                    </a>
                <?php endif; ?>
                <?php if ($nextPost): ?>
                    <a class="btn btn-primary"
                       href="<?= $escaper->escapeUrl($nextPost->getPostUrl()) ?>"
                       title="<?= $escaper->escapeHtmlAttr(__('Read %1', $nextPost->getTitle())) ?>">
                        <?= $escaper->escapeHtml(__('Next &rarr;')) ?>
                    </a>
                <?php endif; ?>
            </div>
        </div>
    <?php endif; ?>
<?php endif; ?>
