style: grille 3 colonnes sur desktop (row-cols-lg-3)

This commit is contained in:
Cedric Abonnel
2026-05-08 13:44:26 +02:00
parent 0bf9213713
commit 87172baf68
2 changed files with 24 additions and 19 deletions
+23 -18
View File
@@ -5,28 +5,33 @@ $Parsedown = new Parsedown();
ob_start();
?>
<div class="posts-list">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
<?php foreach ($posts as $post): ?>
<?php
$html = $Parsedown->text($post['content']);
$preview = mb_strimwidth(strip_tags($html), 0, 240, '…');
$preview = mb_strimwidth(strip_tags($html), 0, 160, '…');
?>
<article class="post-entry">
<h2 class="post-entry-title">
<a href="route.php?action=view&id=<?= $post['id'] ?>">
<?= htmlspecialchars($post['title']) ?>
</a>
<?php if (!$post['is_published']): ?>
<span class="badge bg-warning ms-2">Brouillon</span>
<?php endif; ?>
</h2>
<p class="post-entry-excerpt"><?= htmlspecialchars($preview) ?></p>
<div class="post-entry-meta">
<span><?= date('d/m/Y', strtotime($post['created_at'])) ?></span>
<a href="route.php?action=edit&id=<?= $post['id'] ?>" class="post-entry-edit">modifier</a>
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="post-entry-read">→ lire</a>
</div>
</article>
<div class="col">
<article class="card h-100">
<div class="card-body d-flex flex-column">
<h2 class="card-title">
<a href="route.php?action=view&id=<?= $post['id'] ?>">
<?= htmlspecialchars($post['title']) ?>
</a>
<?php if (!$post['is_published']): ?>
<span class="badge bg-warning ms-1">Brouillon</span>
<?php endif; ?>
</h2>
<p class="card-text flex-grow-1"><?= htmlspecialchars($preview) ?></p>
<div class="post-entry-meta mt-auto">
<span><?= date('d/m/Y', strtotime($post['created_at'])) ?></span>
<a href="route.php?action=edit&id=<?= $post['id'] ?>" class="post-entry-edit">modifier</a>
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="post-entry-read">→ lire</a>
</div>
</div>
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="stretched-link"></a>
</article>
</div>
<?php endforeach; ?>
</div>