|
1 | 1 | <?php |
2 | 2 | /** |
3 | 3 | * @var \App\View\AppView $this |
| 4 | + * @var iterable<\App\Model\Entity\Package> $featuredPackages |
4 | 5 | * @var iterable<\App\Model\Entity\Package> $packages |
5 | 6 | * @var iterable<\Tags\Model\Entity\Tag> $cakephpTags |
6 | 7 | * @var iterable<\Tags\Model\Entity\Tag> $phpTags |
7 | 8 | */ |
8 | 9 | ?> |
9 | 10 | <div class="packages index content"> |
| 11 | + <?php $featuredPackageNames = array_column((array)$featuredPackages, 'package'); ?> |
10 | 12 | <div class="px-4 py-8 sm:px-6 lg:px-8"> |
11 | 13 | <div class="mb-8 flex flex-col gap-5 xl:flex-row xl:items-end xl:justify-between"> |
12 | 14 | <div> |
|
43 | 45 | </div> |
44 | 46 | </div> |
45 | 47 |
|
| 48 | + <?php if ($featuredPackages) : ?> |
| 49 | + <section class="mb-8"> |
| 50 | + <div class="mb-5 flex items-end justify-between gap-4"> |
| 51 | + <div> |
| 52 | + <p class="text-sm font-medium uppercase tracking-[0.2em] text-cake-red"><?= __('Featured') ?></p> |
| 53 | + </div> |
| 54 | + <div class="hidden items-center gap-3 md:flex"> |
| 55 | + <button type="button" class="featured-packages-slider-button" data-featured-packages-prev aria-label="<?= __('Previous featured package') ?>"> |
| 56 | + ← |
| 57 | + </button> |
| 58 | + <button type="button" class="featured-packages-slider-button" data-featured-packages-next aria-label="<?= __('Next featured package') ?>"> |
| 59 | + → |
| 60 | + </button> |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + <div class="featured-packages-slider-shell"> |
| 64 | + <div class="featured-packages-slider swiper" data-featured-packages-slider> |
| 65 | + <div class="swiper-wrapper"> |
| 66 | + <?php foreach ($featuredPackages as $package) : ?> |
| 67 | + <div class="swiper-slide"> |
| 68 | + <?= $this->element('Packages/package-tile', ['package' => $package, 'isFeatured' => true]) ?> |
| 69 | + </div> |
| 70 | + <?php endforeach; ?> |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + </section> |
| 75 | + <?php endif; ?> |
| 76 | + |
46 | 77 | <div class="grid gap-6 md:grid-cols-2 xl:grid-cols-3"> |
47 | 78 | <?php foreach ($packages as $package) : ?> |
48 | | - <?= $this->element('Packages/package-tile', ['package' => $package]) ?> |
| 79 | + <?= $this->element('Packages/package-tile', [ |
| 80 | + 'package' => $package, |
| 81 | + 'isFeatured' => in_array($package->package, $featuredPackageNames, true), |
| 82 | + ]) ?> |
49 | 83 | <?php endforeach; ?> |
50 | 84 | </div> |
51 | 85 |
|
|
0 commit comments