Files

66 lines
2.8 KiB
PHTML
Raw Permalink Normal View History

<?php
/**
* @var string $renderedHtml Rendered markdown HTML
* @var array<int, array<string, mixed>> $tocItems TOC headings [{level, text, anchor}]
* @var array<string, array<string, string>> $docGroups Grouped doc navigation
* @var string $currentSlug Active slug
* @var string $currentTitle Active doc title
2026-03-04 15:56:58 +01:00
* @var string $defaultSlug Default docs slug from catalog order
*/
?>
<div class="app-docs-container">
<aside class="app-docs-nav" aria-label="<?php e(t('Documentation navigation')); ?>">
2026-02-23 12:58:19 +01:00
<nav data-details-storage="admin-docs-nav-groups-v1">
<?php $groupIndex = 0; ?>
<?php foreach ($docGroups as $groupLabel => $items): ?>
2026-02-23 12:58:19 +01:00
<?php
$groupKey = 'docs-nav-group-' . ((string) (array_key_first($items) ?? $groupIndex));
$groupOpen = array_key_exists($currentSlug, $items);
$groupIndex++;
?>
<div class="app-docs-nav-group">
2026-02-23 12:58:19 +01:00
<details data-details-key="<?php e($groupKey); ?>" <?php if ($groupOpen): ?>open<?php endif; ?>>
<summary><small class="muted"><?php e($groupLabel); ?></small></summary>
<ul>
<?php foreach ($items as $docSlug => $label): ?>
<?php $isActive = $docSlug === $currentSlug; ?>
<li>
<a href="<?php e(lurl('admin/docs/' . $docSlug)); ?>"
class="<?php e($isActive ? 'active' : ''); ?>"
<?php if ($isActive): ?>aria-current="page" <?php endif; ?>>
<?php e($label); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</details>
<hr>
</div>
<?php endforeach; ?>
</nav>
</aside>
<article class="app-docs-content">
<?php MintyPHP\Buffer::get('docs_rendered_html'); ?>
</article>
<?php if ($tocItems): ?>
<aside class="app-docs-toc" aria-label="<?php e(t('On this page')); ?>">
<small class="muted"><?php e(t('On this page')); ?></small>
<ul>
<?php foreach ($tocItems as $item): ?>
<li class="app-docs-toc-level-<?php e((string) $item['level']); ?>">
<a href="<?php e(lurl('admin/docs/' . $currentSlug) . '#' . $item['anchor']); ?>"><?php e($item['text']); ?></a>
</li>
<?php endforeach; ?>
</ul>
</aside>
<?php endif; ?>
</div>
<script type="module" src="<?php e(assetVersion('js/pages/admin-docs-index.js')); ?>"></script>