шаг 4 завершен

This commit is contained in:
Alisa
2026-06-04 01:30:45 +03:00
parent 62ce8c4d01
commit 238831ad3a
26 changed files with 1703 additions and 70 deletions
+47
View File
@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
/** @var array<int, array<string, mixed>> $categories */
/** @var array<string, mixed>|null $currentCategory */
/** @var array<int, array<string, mixed>> $products */
$heading = $currentCategory['h1'] ?? $currentCategory['name'] ?? 'Каталог продукции';
?>
<section class="catalog-layout">
<aside class="catalog-sidebar">
<div class="panel sticky-panel">
<h2>Категории</h2>
<?php
$items = $categories;
$depth = 0;
$currentSlug = $currentCategory['slug'] ?? '';
require base_path('views/partials/category-tree.php');
?>
</div>
</aside>
<section class="catalog-content">
<div class="catalog-heading">
<p class="eyebrow"><?= $currentCategory === null ? 'Полный каталог' : 'Категория' ?></p>
<h1><?= e($heading) ?></h1>
<?php if (!empty($currentCategory['description'])): ?>
<p><?= e($currentCategory['description']) ?></p>
<?php else: ?>
<p class="muted">Выберите категорию слева или смотрите товары сразу в каталоге.</p>
<?php endif; ?>
</div>
<?php if ($products === []): ?>
<div class="panel">
<p class="muted">В этой категории товары появятся после переноса каталога со старого сайта.</p>
</div>
<?php else: ?>
<div class="product-grid catalog-product-grid">
<?php foreach ($products as $product): ?>
<?php require base_path('views/partials/product-card.php'); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>
</section>