Show category cover thumbnails on public gallery
This commit is contained in:
parent
b789085c33
commit
0bb5b4dcf9
|
|
@ -99,7 +99,16 @@ if ($selectedCategory !== null && $selectedCategory !== '' && !isset($categories
|
|||
<?php else: ?>
|
||||
<div class="categories-grid">
|
||||
<?php foreach ($categories as $categoryName => $images): ?>
|
||||
<?php $cover = $images[0]['thumb_path'] ?? null; ?>
|
||||
<a class="category-card" href="?category=<?= urlencode($categoryName) ?>">
|
||||
<?php if ($cover): ?>
|
||||
<img
|
||||
class="category-cover"
|
||||
src="<?= htmlspecialchars($cover, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?>"
|
||||
alt="<?= htmlspecialchars($categoryName, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?>"
|
||||
loading="lazy"
|
||||
>
|
||||
<?php endif; ?>
|
||||
<span class="category-title"><?= htmlspecialchars($categoryName, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?></span>
|
||||
<span class="category-count"><?= count($images) ?> фото</span>
|
||||
</a>
|
||||
|
|
|
|||
12
style.css
12
style.css
|
|
@ -88,12 +88,22 @@ h2 {
|
|||
background: var(--surface-soft);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
padding: 12px;
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
|
||||
}
|
||||
|
||||
.category-cover {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
object-fit: cover;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.category-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 22px rgba(31, 111, 235, 0.12);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user