HummingBirdAnimeClient/app/templates/tabs.php
Timothy J. Warren 386938c75f
Some checks reported errors
timw4mail/HummingBirdAnimeClient/pipeline/head Something is wrong with the build of this commit
Create component system to help cut down on view duplication, see #31
2020-08-21 12:30:01 -04:00

23 lines
574 B
PHP

<div class="tabs">
<?php $i = 0; foreach ($data as $tabName => $tabData): ?>
<?php if ( ! empty($tabData)): ?>
<?php $id = "{$name}-{$i}"; ?>
<input
role='tab'
aria-controls="_<?= $id ?>"
type="radio"
name="<?= $name ?>"
id="<?= $id ?>"
<?= ($i === 0) ? 'checked="checked"' : '' ?>
/>
<label for="<?= $id ?>"><?= ucfirst($tabName) ?></label>
<section
id="_<?= $id ?>"
role="tabpanel"
class="<?= $className ?>"
>
<?= $callback($tabData, $tabName) ?>
</section>
<?php endif ?>
<?php $i++; endforeach ?>
</div>