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

@@ -88,18 +88,18 @@ $rootDirs = ['tfe', 'these', 'frart', 'documents', 'theses'];
function fileIcon(string $ext): string {
$ext = strtolower($ext);
if ($ext === 'pdf') {
return '<img src="/assets/icons/file-text-audio.svg" width="24" height="24" alt="" aria-hidden="true">';
return icon('file-text-audio');
}
if (in_array($ext, ['zip', 'tar', 'gz', 'bz2', 'xz', '7z', 'rar'], true)) {
return '<img src="/assets/icons/file-doc.svg" width="24" height="24" alt="" aria-hidden="true">';
return icon('file-doc');
}
// Default text-file icon for all other extensions
return '<img src="/assets/icons/file-lines.svg" width="24" height="24" alt="" aria-hidden="true">';
return icon('file-lines');
}
// SVG folder icon (same for all directories)
function folderIcon(): string {
return '<img src="/assets/icons/folder.svg" width="24" height="24" alt="" aria-hidden="true">';
return icon('folder');
}
?>
<div id="file-browser-container" class="file-browser">

View File

@@ -98,7 +98,7 @@ if (empty($orphans)) {
<?= $v['linkedTo'] !== null ? 'disabled title="Déjà liée au TFE ' . htmlspecialchars($v['linkedTo']) . '"' : '' ?>
>
<span class="file-browser-icon">
<img src="/assets/icons/arrow-circle-left.svg" width="24" height="24" alt="" aria-hidden="true">
<?= icon('arrow-circle-left') ?>
</span>
<span class="file-browser-name"><?= htmlspecialchars($v['name']) ?></span>
<span class="file-browser-size"><?= !empty($v['createdAt']) ? substr($v['createdAt'], 0, 10) : '' ?></span>