черновая шапка и первый скрол с лого завершено

This commit is contained in:
Alisa
2026-06-04 21:05:10 +03:00
parent e1c66ae53c
commit 7d14383031
9 changed files with 940 additions and 97 deletions
+40
View File
@@ -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; ?>