Type de ressource : Composant Astro (UI atomique)
Fichier source :src/components/Footer.astro
Statut : Actif
1. Vue dâensemble
Section titled â1. Vue dâensembleâ1.1. Description
Section titled â1.1. DescriptionâComposant de pied de page contenant le copyright avec lâannĂ©e courante et les liens vers les rĂ©seaux sociaux (Mastodon, Twitter, GitHub).
1.2. Objectif
Section titled â1.2. Objectifâ- Afficher le copyright avec lâannĂ©e courante
- Fournir des liens vers les réseaux sociaux
- Assurer une cohérence visuelle en bas de page
- Compléter la navigation globale du site
1.3. Caractéristiques
Section titled â1.3. CaractĂ©ristiquesâ| PropriĂ©tĂ© | Valeur |
|---|---|
| Type | UI atomique |
| Hydratation | Aucune |
| Framework JS | Aucun |
| Accessibilité | Partiellement conforme |
| Responsive | Non applicable |
2. Architecture et structure
Section titled â2. Architecture et structureâ2.1. Emplacement dans lâarborescence
Section titled â2.1. Emplacement dans lâarborescenceâsrc/components/âââ BaseHead.astroâââ Header.astroâââ Footer.astroâââ FormattedDate.astroâââ HeaderLink.astro2.2. Composants dĂ©pendants
Section titled â2.2. Composants dĂ©pendantsâ| Composant parent | Fichier | Relation |
|---|---|---|
| Toutes les pages | src/pages/*.astro |
Utilisation dans le <body> |
2.3. Composants enfants utilisés
Section titled â2.3. Composants enfants utilisĂ©sâAucun composant enfant nâest utilisĂ© (composant leaf).
3. Implémentation
Section titled â3. ImplĂ©mentationâ3.1. Variante : Composant UI atomique (HTML + CSS purs)
Section titled â3.1. Variante : Composant UI atomique (HTML + CSS purs)â---const today = new Date();---
<footer> © {today.getFullYear()} Your name here. All rights reserved. <div class="social-links"> <a href="https://m.webtoo.ls/@astro" target="_blank"> <span class="sr-only">Follow Astro on Mastodon</span> <svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32" astro-icon="social/mastodon"> <path fill="currentColor" d="M11.19 12.195c2.016-.24 3.77-1.475 3.99-2.603.348-1.778.32-4.339.32-4.339 0-3.47-2.286-4.488-2.286-4.488C12.062.238 10.083.017 8.027 0h-.05C5.92.017 3.942.238 2.79.765c0 0-2.285 1.017-2.285 4.488l-.002.662c-.004.64-.007 1.35.011 2.091.083 3.394.626 6.74 3.78 7.57 1.454.383 2.703.463 3.709.408 1.823-.1 2.847-.647 2.847-.647l-.06-1.317s-1.303.41-2.767.36c-1.45-.05-2.98-.156-3.215-1.928a3.614 3.614 0 0 1-.033-.496s1.424.346 3.228.428c1.103.05 2.137-.064 3.188-.189zm1.613-2.47H11.13v-4.08c0-.859-.364-1.295-1.091-1.295-.804 0-1.207.517-1.207 1.541v2.233H7.168V5.89c0-1.024-.403-1.541-1.207-1.541-.727 0-1.091.436-1.091 1.296v4.079H3.197V5.522c0-.859.22-1.541.66-2.046.456-.505 1.052-.764 1.793-.764.856 0 1.504.328 1.933.983L8 4.39l.417-.695c.429-.655 1.077-.983 1.934-.983.74 0 1.336.259 1.791.764.442.505.661 1.187.661 2.046v4.203z" /> </svg> </a> <a href="https://twitter.com/astrodotbuild" target="_blank"> <span class="sr-only">Follow Astro on Twitter</span> <svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32" astro-icon="social/twitter"> <path fill="currentColor" d="M5.026 15c6.038 0 9.341-5.003 9.341-9.334 0-.14 0-.282-.006-.422A6.685 6.685 0 0 0 16 3.542a6.658 6.658 0 0 1-1.889.518 3.301 3.301 0 0 0 1.447-1.817 6.533 6.533 0 0 1-2.087.793A3.286 3.286 0 0 0 7.875 6.03a9.325 9.325 0 0 1-6.767-3.429 3.289 3.289 0 0 0 1.018 4.382A3.323 3.323 0 0 1 .64 6.575v.045a3.288 3.288 0 0 0 2.632 3.218 3.203 3.203 0 0 1-.865.115 3.23 3.23 0 0 1-.614-.057 3.283 3.283 0 0 0 3.067 2.277A6.588 6.588 0 0 1 .78 13.58a6.32 6.32 0 0 1-.78-.045A9.344 9.344 0 0 0 5.026 15z" /> </svg> </a> <a href="https://github.com/withastro/astro" target="_blank"> <span class="sr-only">Go to Astro's GitHub repo</span> <svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32" astro-icon="social/github"> <path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z" /> </svg> </a> </div></footer><style> footer { padding: 2em 1em 6em 1em; background: linear-gradient(var(--gray-gradient)) no-repeat; color: rgb(var(--gray)); text-align: center; } .social-links { display: flex; justify-content: center; gap: 1em; margin-top: 1em; } .social-links a { text-decoration: none; color: rgb(var(--gray)); } .social-links a:hover { color: rgb(var(--gray-dark)); }</style>3.2. Utilisation dans une page
Section titled â3.2. Utilisation dans une pageâ---import Footer from '../components/Footer.astro';---
<!doctype html><html lang="en"> <body> <main> <!-- Contenu de la page --> </main> <Footer /> </body></html>4. Props et interface
Section titled â4. Props et interfaceâ4.1. Props obligatoires
Section titled â4.1. Props obligatoiresâAucune prop nâest obligatoire (composant sans props).
4.2. Props optionnelles
Section titled â4.2. Props optionnellesâAucune prop nâest disponible (composant sans props).
4.3. Slots
Section titled â4.3. SlotsâAucun slot nâest implĂ©mentĂ© dans ce composant.
5. StratĂ©gie dâhydratation
Section titled â5. StratĂ©gie dâhydratationâ5.1. Politique dâhydratation
Section titled â5.1. Politique dâhydratationâ| Type de composant | StratĂ©gie | Rationale |
|---|---|---|
| Composant UI atomique | Aucune | HTML + CSS purs, pas dâinteraction |
5.2. Directives Astro utilisées
Section titled â5.2. Directives Astro utilisĂ©esâAucune directive nâest utilisĂ©e (composant HTML pur).
5.3. Impact sur les performances
Section titled â5.3. Impact sur les performancesâ| MĂ©trique | Sans hydratation |
|---|---|
| HTML size | +2 KB |
| CSS size | +1 KB |
| JS size | 0 KB |
| TTI | Immédiat |
6. Styles et design system
Section titled â6. Styles et design systemâ6.1. Utilisation des design tokens
Section titled â6.1. Utilisation des design tokensâ/* Le composant utilise des variables CSS personnalisĂ©es */footer { background: linear-gradient(var(--gray-gradient)) no-repeat; color: rgb(var(--gray));}
.social-links a:hover { color: rgb(var(--gray-dark));}6.2. Responsive design
Section titled â6.2. Responsive designâNon applicable - le composant utilise des flexbox responsive par dĂ©faut.
6.3. Mode sombre
Section titled â6.3. Mode sombreâNon implĂ©mentĂ© - le composant utilise des variables CSS personnalisĂ©es.
7. Accessibilité (a11y)
Section titled â7. AccessibilitĂ© (a11y)â7.1. ConformitĂ© WCAG 2.1 AA
Section titled â7.1. ConformitĂ© WCAG 2.1 AAâ| CritĂšre | ImplĂ©mentation | Statut |
|---|---|---|
| 1.1.1 Non-text Content | Alt text pour les SVG (aria-hidden) | â |
| 1.3.1 Info and Relationships | Structure HTML sémantique (<footer>) |
â |
| 1.4.3 Contrast (Minimum) | Non testĂ© | â ïž |
| 2.1.1 Keyboard | Navigation clavier complĂšte (Tab, Enter) | â |
| 2.4.7 Focus Visible | Non testĂ© | â ïž |
| 4.1.2 Name, Role, Value | sr-only pour les liens sociaux |
â |
7.2. Attributs ARIA utilisés
Section titled â7.2. Attributs ARIA utilisĂ©sâ<!-- Liens sociaux --><span class="sr-only">Follow Astro on Mastodon</span><svg aria-hidden="true">...</svg>7.3. Navigation clavier
Section titled â7.3. Navigation clavierâ| Touche | Action |
|---|---|
Tab |
Navigation vers les liens sociaux |
Enter |
Activation des liens |
7.4. Tests dâaccessibilitĂ©
Section titled â7.4. Tests dâaccessibilitĂ©â# Test avec Lighthousenpx lighthouse http://localhost:4321/ --view8. Performance et optimisation
Section titled â8. Performance et optimisationâ8.1. Optimisations appliquĂ©es
Section titled â8.1. Optimisations appliquĂ©esâ- â HTML statique par dĂ©faut
- â CSS scoped
- â Pas de JavaScript
- â SVG inline (pas de requĂȘte HTTP supplĂ©mentaire)
- â Astro Icons pour les SVG (si configurĂ©)
8.2. Core Web Vitals
Section titled â8.2. Core Web Vitalsâ| MĂ©trique | Objectif | StratĂ©gie |
|---|---|---|
| LCP | < 2.5s | Pas de JS bloquant |
| INP | < 200ms | Pas de JS |
| CLS | < 0.1 | Dimensions explicites des SVG |
8.3. Taille du composant
Section titled â8.3. Taille du composantâ| Type | HTML | CSS | JS (hydratĂ©) | Total |
|---|---|---|---|---|
| UI atomique | 2 KB | 1 KB | 0 KB | 3 KB |
9. Débogage et troubleshooting
Section titled â9. DĂ©bogage et troubleshootingâ9.1. ProblĂšmes courants
Section titled â9.1. ProblĂšmes courantsâ| SymptĂŽme | Cause probable | Solution |
|---|---|---|
| Année incorrecte | Calcul cÎté serveur | Vérifier que new Date() est appelé correctement |
| Styles cassés | Variables CSS non définies | Vérifier les variables CSS personnalisées |
| SVG non affichés | Astro Icons non configuré | Vérifier la configuration Astro Icons |
9.2. Tests manuels
Section titled â9.2. Tests manuelsâ# Test localnpm run dev
# Vérification de l'année# Vérifier que l'année affichée est l'année courante9.3. Logs et monitoring
Section titled â9.3. Logs et monitoringâNon applicable (composant statique).
10. Bonnes pratiques
Section titled â10. Bonnes pratiquesâ10.1. Architecture
Section titled â10.1. Architectureâ- â Calcul de lâannĂ©e cĂŽtĂ© serveur (pas de JavaScript)
- â
Utilisation de
sr-onlypour le texte alternatif - â
Utilisation de
aria-hidden="true"pour les SVG dĂ©coratifs - â CSS scoped pour Ă©viter les fuites de styles
10.2. Accessibilité
Section titled â10.2. AccessibilitĂ©â- â
Utiliser des éléments HTML sémantiques (
<footer>) - â Fournir du texte alternatif pour les liens sociaux
- â Tester la navigation au clavier
- â ïž AmĂ©liorer le contraste des couleurs
- â ïž AmĂ©liorer le focus visible
10.3. Performance
Section titled â10.3. Performanceâ- â Ăviter lâhydratation (pas dâinteraction requise)
- â SVG inline (pas de requĂȘte HTTP)
10.4. Maintenance
Section titled â10.4. Maintenanceâ- â Mettre Ă jour le nom du propriĂ©taire (âYour name hereâ)
- â Mettre Ă jour les liens sociaux selon les besoins
11. Ăvolutions et roadmap
Section titled â11. Ăvolutions et roadmapâ11.1. AmĂ©liorations planifiĂ©es
Section titled â11.1. AmĂ©liorations planifiĂ©esâ- Ajout du mode sombre
- Amélioration du contraste pour WCAG AA
- Amélioration du focus visible
- Personnalisation du nom du propriétaire via props
11.2. Limitations connues
Section titled â11.2. Limitations connuesâ- â Nom du propriĂ©taire hardcodĂ© (âYour name hereâ)
- â Pas de mode sombre
- â Liens sociaux hardcodĂ©s (non configurables)
- â Astro Icons peut ne pas ĂȘtre configurĂ©
12. Ressources liées
Section titled â12. Ressources liĂ©esâ- Documentation Astro : Components
- Documentation Astro Icons : Astro Icons
- Composants associés :
src/components/Header.astro
13. Historique des modifications
Section titled â13. Historique des modificationsâ| Date | Version | Description | Auteur |
|---|---|---|---|
| 2026-09-15 | 1.0 | Création initiale | Devin |