Files
nav-carte/components/MediaTabProjets.vue
T
Jules NenyandClaude Opus 5.5 52cac98e1b fix(media): recette XL publications (M4) : <main>, URL longues coupées, couverture recadrée
Racine de l'onglet Publications en <main> (Lighthouse a11y 98 -> 100, la page n'avait
pas de repère principal) ; description en overflow-wrap:anywhere (l'URL Calaméo
débordait de la carte) ; couverture transition-agricole recadrée hors pictogramme.
DESIGN-SYSTEM.md : une ligne sur la carte de publication.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWGVn3kY4vPBaWF9EFkZbz
2026-11-03 14:54:36 +01:00

187 lines
5.7 KiB
Vue

<template>
<!-- <main> : la page /media n'en avait pas (Lighthouse landmark-one-main) ; l'onglet visuel n'est pas touché. -->
<main class="media-tab-projets" style="padding: 1.5rem; overflow-y: auto;">
<div style="max-width: 70ch; margin-bottom: 1.5rem;">
<h2 style="font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--nav-text);">Publications</h2>
<p style="font-size: 0.9rem; line-height: 1.6; color: var(--nav-text);">
Mutualiser le savoir. Voici les PFE engagés publiés en ligne dont nous avons connaissance.
Partage-nous le lien de ton travail si tu veux participer à cette initiative.
</p>
</div>
<!-- Lot XL publications : toute la carte est le lien (un seul <a>), image en tête, auteurs nommés. -->
<ul class="projets-grid" role="list">
<li v-for="p in projets" :key="p.id">
<a class="projet-carte" :href="p.url" target="_blank" rel="noopener">
<img
class="projet-carte__image"
:src="p.illustration"
:alt="altDe(p)"
width="800"
height="600"
loading="lazy"
decoding="async"
/>
<span class="projet-carte__corps">
<h3 class="projet-carte__titre">{{ p.titre }}</h3>
<span class="projet-carte__auteurs">{{ signature(p) }}</span>
<span v-if="meta(p)" class="projet-carte__meta">{{ meta(p) }}</span>
<span class="projet-carte__description">{{ p.description }}</span>
<span v-if="p.credit_illustration" class="projet-carte__credit">Image : {{ minuscule(p.credit_illustration) }}</span>
<span v-if="p.link_status === 'broken'" class="projet-carte__alerte">Lien d'origine cassé</span>
<span class="projet-carte__indice">Découvrir<span class="sr-only"> (nouvel onglet)</span></span>
</span>
</a>
</li>
</ul>
<p style="margin-top: 2rem; font-size: 0.875rem; color: var(--nav-text-muted);">
Tu as un PFE engagé à partager ? <a href="mailto:contact@trans-former.fr" style="color: var(--nav-primary-solid);">Écris-moi</a>.
</p>
</main>
</template>
<script setup lang="ts">
interface Projet {
id: string
titre: string
collectif?: string
auteurs: string[]
annee?: string | null
ecole?: string | null
url: string
description: string
illustration: string
illustration_a_venir?: boolean
credit_illustration?: string | null
link_status?: string
}
const { data: pfeData } = await useFetch<{ projets: Projet[] }>('/data/pfe-engages.json')
const projets = computed(() => pfeData.value?.projets ?? [])
/** « A », « A et B », « A, B et C ». */
function enumere(noms: string[]): string {
const n = noms.filter(a => a && a !== 'Inconnu')
return n.length < 2 ? (n[0] ?? '') : `${n.slice(0, -1).join(', ')} et ${n[n.length - 1]}`
}
function signature(p: Projet): string {
const noms = enumere(p.auteurs || [])
return p.collectif ? `${p.collectif} : ${noms}` : noms
}
function meta(p: Projet): string {
return [p.ecole, p.annee].filter(v => v && v !== 'Inconnu').join(', ')
}
function minuscule(s: string): string {
return s.charAt(0).toLowerCase() + s.slice(1)
}
function altDe(p: Projet): string {
if (p.illustration_a_venir) return `Illustration à venir pour « ${p.titre} »`
return `${p.credit_illustration ?? 'Illustration'} : « ${p.titre} », par ${enumere(p.auteurs || [])}`
}
</script>
<style scoped>
.projets-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
gap: 1.25rem;
margin: 0;
padding: 0;
list-style: none;
}
.projets-grid > li {
display: flex;
min-width: 0;
}
.projet-carte {
display: flex;
flex-direction: column;
width: 100%;
min-width: 0;
min-height: 44px;
overflow: hidden;
border: 1px solid var(--border, var(--bg-alt));
border-radius: var(--radius-md, 10px);
background: var(--surface);
color: var(--text);
text-decoration: none;
transition: background-color var(--dur-fast, 150ms) var(--ease-out, ease-out),
box-shadow var(--dur-fast, 150ms) var(--ease-out, ease-out);
}
@media (prefers-reduced-motion: reduce) {
.projet-carte { transition: none; }
}
.projet-carte:hover {
background: var(--surface-2);
box-shadow: var(--shadow-sm);
}
.projet-carte:focus-visible {
outline: 2px solid var(--focus-ring);
outline-offset: 2px;
}
.projet-carte__image {
display: block;
width: 100%;
height: auto;
aspect-ratio: 4 / 3;
object-fit: cover;
background: var(--bg-alt);
}
.projet-carte__corps {
display: flex;
flex: 1;
flex-direction: column;
gap: 0.35rem;
padding: var(--space-sm, 0.75rem) var(--space-md, 1rem) var(--space-md, 1rem);
}
.projet-carte__titre {
margin: 0.15rem 0 0;
font-size: 0.95rem;
font-weight: 600;
line-height: 1.35;
}
.projet-carte__auteurs {
font-size: 0.85rem;
font-weight: 500;
}
/* Texte atténué : color-mix, pas --text-muted (sous AA à 0,8 rem), cf. DESIGN-SYSTEM.md */
.projet-carte__meta,
.projet-carte__credit {
font-size: 0.8rem;
color: color-mix(in srgb, var(--text) 78%, transparent);
}
.projet-carte__description {
flex: 1;
overflow-wrap: anywhere;
margin-top: 0.25rem;
font-size: 0.875rem;
line-height: 1.5;
}
.projet-carte__alerte {
font-size: 0.8rem;
color: var(--warning, #b45309);
}
.projet-carte__indice {
margin-top: 0.5rem;
font-size: 0.875rem;
font-weight: 600;
color: var(--nav-primary-solid);
}
.projet-carte:hover .projet-carte__indice {
text-decoration: underline;
text-underline-offset: 3px;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
</style>