Migrate all <img>-based icons to inline SVG via PHP helper

Replace every <img src="/assets/icons/..."> with <?= icon('name') ?>
across 26 template files. The PHP helper inlines the SVG markup into the
DOM so CSS color cascades naturally through fill="currentColor".

- Add src/icon.php helper: reads SVG file, sets width/height to 1em,
  injects aria-hidden, supports optional CSS class
- Fix 12 icon SVGs that had hardcoded fill="#000000" or missing fill attr
- Replace search.svg with Phosphor fill-based magnifying glass
- Add explicit SVG sizes for admin header nav icons (16px/20px)
- Scope public search icon CSS to form[role=search]:not(.header-search-form)
  to avoid breaking admin header layout; change stroke to fill
- Remove <img> filter: brightness(0) invert(1) hacks from admin.css
This commit is contained in:
Pontoporeia
2026-06-21 17:23:37 +02:00
parent b1774e6e97
commit dfde88eaa5
42 changed files with 166 additions and 108 deletions

View File

@@ -87,7 +87,7 @@ $sortArrow = function(string $col) use ($sortCol, $sortDir): string {
<td class="admin-actions-col">
<div class="admin-actions">
<a href="/admin/edit.php?id=<?= $thesis['id'] ?>" class="admin-icon-btn admin-icon-btn--edit" title="Éditer" onclick="event.stopPropagation()">
<img src="/assets/icons/pencil-note.svg" width="32" height="32" alt="" aria-hidden="true">
<?= icon('pencil-note') ?>
</a>
<form method="post" action="actions/publish.php" class="publish-form" onclick="event.stopPropagation()">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
@@ -95,12 +95,12 @@ $sortArrow = function(string $col) use ($sortCol, $sortDir): string {
<?php if ($thesis['is_published']): ?>
<input type="hidden" name="action" value="unpublish">
<button type="submit" class="admin-icon-btn admin-icon-btn--unpublish" title="Dépublier">
<img src="/assets/icons/eye-slash.svg" width="32" height="32" alt="" aria-hidden="true">
<?= icon('eye-slash') ?>
</button>
<?php else: ?>
<input type="hidden" name="action" value="publish">
<button type="submit" class="admin-icon-btn admin-icon-btn--publish" title="Publier">
<img src="/assets/icons/eye.svg" width="32" height="32" alt="" aria-hidden="true">
<?= icon('eye') ?>
</button>
<?php endif; ?>
</form>
@@ -109,7 +109,7 @@ $sortArrow = function(string $col) use ($sortCol, $sortDir): string {
<input type="hidden" name="thesis_id" value="<?= $thesis['id'] ?>">
<button type="button" class="admin-icon-btn admin-icon-btn--delete" title="Supprimer"
onclick="event.stopPropagation(); confirmDelete(<?= $thesis['id'] ?>, <?= htmlspecialchars(json_encode($thesis['title']), ENT_QUOTES) ?>)">
<img src="/assets/icons/trash.svg" width="32" height="32" alt="" aria-hidden="true">
<?= icon('trash') ?>
</button>
</form>
</div>