<?php

use Fisharebest\Webtrees\I18N;
use Illuminate\Support\Collection;

/**
 * @var Collection<int,object> $faqs
 * @var string                 $title
 */

?>

<h2 class="wt-page-title"><?= $title ?></h2>

<table class="faq">
    <?php foreach ($faqs as $id => $faq) : ?>
    <tr>
        <td style="padding: 5px;">
            <a href="#faq<?= e($id) ?>"><?= e($faq->header) ?></a>
        </td>
    </tr>
    <?php endforeach ?>
</table>

<?php foreach ($faqs as $id => $faq) : ?>
    <hr>
    <div class="faq_title" id="faq<?= $id ?>">
        <?= e($faq->header) ?>
        <div class="faq_top faq_italic">
            <a href="#content"><?= I18N::translate('back to top') ?></a>
        </div>
    </div>
    <div class="faq_body">
        <?= str_starts_with($faq->faqbody, '<') ? $faq->faqbody : nl2br(e($faq->faqbody), false) ?>
    </div>
<?php endforeach ?>
