черновая шапка и первый скрол с лого завершено
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var array<int, array<string, mixed>> $megaCategories */
|
||||
|
||||
if (!function_exists('render_mega_category_children')) {
|
||||
/**
|
||||
* @param array<int, array<string, mixed>> $children
|
||||
*/
|
||||
function render_mega_category_children(array $children, int $depth = 1): void
|
||||
{
|
||||
if ($children === [] || $depth > 3) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<ul class="mega-submenu depth-<?= e((string) $depth) ?>">
|
||||
<?php foreach ($children as $child): ?>
|
||||
<li>
|
||||
<a href="/catalog/<?= e((string) $child['slug']) ?>"><?= e((string) $child['name']) ?></a>
|
||||
<?php render_mega_category_children($child['children'] ?? [], $depth + 1); ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if ($megaCategories !== []): ?>
|
||||
<nav class="category-mega-bar" aria-label="Категории товаров">
|
||||
<div class="category-mega-inner">
|
||||
<?php foreach ($megaCategories as $category): ?>
|
||||
<div class="mega-item">
|
||||
<a class="mega-root" href="/catalog/<?= e((string) $category['slug']) ?>"><?= e((string) $category['name']) ?></a>
|
||||
<?php render_mega_category_children($category['children'] ?? []); ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user