tfe: wrap website iframe in overlay-style div with Site web badge, clearer link text

This commit is contained in:
Pontoporeia
2026-07-10 14:16:05 +02:00
parent c513ad2545
commit f5a7d70fbc
3 changed files with 80 additions and 23 deletions
+1
View File
@@ -49,3 +49,4 @@
- [x] Masquer le bloc "Durée" sur la page TFE quand aucune durée n'est encodée (ni pages ni minutes) - [x] Masquer le bloc "Durée" sur la page TFE quand aucune durée n'est encodée (ni pages ni minutes)
- [x] Fix: locked_year cleared on edit — edit dialog didn't populate the field, so any edit cleared the locked academic year - [x] Fix: locked_year cleared on edit — edit dialog didn't populate the field, so any edit cleared the locked academic year
- [x] Fix repertoire Années column: sort reverse chronological (newest first) instead of ascending alpha - [x] Fix repertoire Années column: sort reverse chronological (newest first) instead of ascending alpha
- [x] TFE website embed: wrap iframe + button in overlay-style div with "Site web" pill badge on left corner, clearer link text
+62 -11
View File
@@ -70,7 +70,7 @@
overflow: visible; overflow: visible;
} }
.tfe-file-item:has(.tfe-file-iframe) { .tfe-file-item:has(.tfe-website-wrapper) {
min-height: 0; min-height: 0;
overflow: visible; overflow: visible;
} }
@@ -118,22 +118,73 @@
border: none; border: none;
} }
.tfe-website-link { /* ── Website embed wrapper (like PDF overlay) ── */
.tfe-website-wrapper {
position: relative;
width: 100%;
display: grid;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
}
.tfe-website-badge {
position: absolute;
top: var(--space-xs);
left: var(--space-xs);
z-index: 2;
display: inline-block;
padding: 0.15em 0.6em;
font-size: var(--step--2);
font-weight: 500;
line-height: 1.4;
color: color-mix(in srgb, var(--accent-primary) 90%, #000);
background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
border: 1px solid color-mix(in srgb, var(--accent-primary) 25%, transparent);
border-radius: var(--radius);
}
.tfe-website-overlay {
position: absolute;
inset: 0;
z-index: 1;
display: grid;
place-items: center;
background: rgb(0 0 0 / 0.12);
backdrop-filter: blur(4px) saturate(0.6);
transition: background 0.2s;
pointer-events: none;
}
.tfe-website-overlay:hover {
background: rgb(0 0 0 / 0.06);
}
.tfe-website-open-btn {
pointer-events: auto;
display: inline-grid; display: inline-grid;
grid-auto-flow: column; grid-auto-flow: column;
align-items: center; align-items: center;
gap: var(--space-3xs); gap: var(--space-2xs);
padding: var(--space-2xs) var(--space-xs); padding: var(--space-xs) var(--space-m);
font-size: var(--step--1); background: var(--accent-primary);
color: var(--accent-primary); color: #fff;
text-decoration: none; border: none;
border: 1px solid var(--border);
border-radius: var(--radius); border-radius: var(--radius);
margin-bottom: var(--space-2xs); font-size: var(--step-0);
font-weight: 500;
text-decoration: none;
cursor: pointer;
box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
transition: transform 0.15s, box-shadow 0.15s;
} }
.tfe-website-link:hover { .tfe-website-open-btn:hover {
background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-primary)); transform: translateY(-1px);
box-shadow: 0 4px 12px rgb(0 0 0 / 0.25);
background: var(--accent-primary);
color: #fff;
} }
.tfe-file-item figcaption { .tfe-file-item figcaption {
+7 -2
View File
@@ -388,18 +388,23 @@
data-pdf-label="<?= htmlspecialchars($_pdfLabel) ?>" data-pdf-label="<?= htmlspecialchars($_pdfLabel) ?>"
tabindex="-1"></div> tabindex="-1"></div>
<?php elseif ($isWebsite): ?> <?php elseif ($isWebsite): ?>
<div class="tfe-website-wrapper">
<span class="tfe-website-badge">Site web</span>
<div class="tfe-website-overlay">
<a href="<?= $mediaUrl ?>" <a href="<?= $mediaUrl ?>"
class="tfe-website-link" class="tfe-website-open-btn"
target="_blank" target="_blank"
rel="noopener noreferrer"> rel="noopener noreferrer">
Ouvrir dans un nouvel onglet Ouvrir le site web
</a> </a>
</div>
<iframe src="<?= $mediaUrl ?>" <iframe src="<?= $mediaUrl ?>"
class="tfe-file-iframe" class="tfe-file-iframe"
title="<?= $fileName ?>" title="<?= $fileName ?>"
sandbox="allow-scripts allow-same-origin" sandbox="allow-scripts allow-same-origin"
loading="lazy"> loading="lazy">
</iframe> </iframe>
</div>
<?php elseif ($isImage): ?> <?php elseif ($isImage): ?>
<img src="<?= $mediaUrl ?>" <img src="<?= $mediaUrl ?>"
alt="<?= htmlspecialchars($caption !== '' ? $caption : $data['title'] . ' — ' . ($data['authors'] ?? '')) ?>" alt="<?= htmlspecialchars($caption !== '' ? $caption : $data['title'] . ' — ' . ($data['authors'] ?? '')) ?>"