✨ Story 2.1: navbar responsive

This commit is contained in:
skycel committed 2026-02-04 16:51:55 +01:00
1 parent 4a5213331d
commit dd6c5d0a72
8 files changed
+231 -40

No files matched your search

+12 -1
View File
@@ -152,6 +152,17 @@
.breadcrumb-current { .breadcrumb-current {
@apply text-text-primary; @apply text-text-primary;
} }
/* Navigation links */
.nav-link {
@apply px-4 py-2 text-sm font-medium text-text-secondary
hover:text-text-primary transition-colors rounded-lg
hover:bg-surface-light;
}
.nav-link-active {
@apply text-primary bg-primary/10;
}
} }
@layer utilities { @layer utilities {
@@ -187,4 +198,4 @@
animation-duration: 0.01ms !important; animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important; transition-duration: 0.01ms !important;
} }
} }
+1 -1
View File
@@ -1 +1 @@
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}html{scroll-behavior:smooth}body{--tw-bg-opacity:1;background-color:rgb(23 23 31/var(--tw-bg-opacity,1));font-family:Inter,system-ui,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body,h1{--tw-text-opacity:1;color:rgb(245 245 247/var(--tw-text-opacity,1))}h1{font-size:2.5rem;line-height:1.2;font-weight:700}h2{font-size:2rem;line-height:1.3}h2,h3{fLine truncated *,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}html{scroll-behavior:smooth}body{--tw-bg-opacity:1;background-color:rgb(23 23 31/var(--tw-bg-opacity,1));font-family:Inter,system-ui,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body,h1{--tw-text-opacity:1;color:rgb(245 245 247/var(--tw-text-opacity,1))}h1{font-size:2.5rem;line-height:1.2;font-weight:700}h2{font-size:2rem;line-height:1.3}h2,h3{fLine truncated
+72 -2
View File
@@ -2,5 +2,75 @@
// Script principal du portfolio // Script principal du portfolio
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
console.log('Portfolio chargé'); initMobileMenu();
}); initNavbarScroll();
});
function initMobileMenu() {
const toggle = document.getElementById('mobile-menu-toggle');
const menu = document.getElementById('mobile-menu');
if (!toggle || !menu) return;
const hamburgerIcon = toggle.querySelector('.hamburger-icon');
const closeIcon = toggle.querySelector('.close-icon');
function openMenu() {
menu.classList.remove('hidden');
menu.setAttribute('aria-hidden', 'false');
toggle.setAttribute('aria-expanded', 'true');
toggle.setAttribute('aria-label', 'Fermer le menu');
hamburgerIcon?.classList.add('hidden');
closeIcon?.classList.remove('hidden');
}
function closeMenu() {
menu.classList.add('hidden');
menu.setAttribute('aria-hidden', 'true');
toggle.setAttribute('aria-expanded', 'false');
toggle.setAttribute('aria-label', 'Ouvrir le menu');
hamburgerIcon?.classList.remove('hidden');
closeIcon?.classList.add('hidden');
}
function toggleMenu() {
const isOpen = toggle.getAttribute('aria-expanded') === 'true';
if (isOpen) {
closeMenu();
} else {
openMenu();
}
}
toggle.addEventListener('click', toggleMenu);
menu.querySelectorAll('a').forEach(link => {
link.addEventListener('click', closeMenu);
});
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && toggle.getAttribute('aria-expanded') === 'true') {
closeMenu();
toggle.focus();
}
});
window.addEventListener('resize', () => {
if (window.innerWidth >= 1024) {
closeMenu();
}
});
}
function initNavbarScroll() {
const navbar = document.getElementById('navbar');
if (!navbar) return;
window.addEventListener('scroll', () => {
if (window.scrollY > 10) {
navbar.classList.add('shadow-lg');
} else {
navbar.classList.remove('shadow-lg');
}
}, { passive: true });
}
+40 -36
View File
@@ -2,7 +2,7 @@
## Status ## Status
Ready for Dev review
## Story ## Story
@@ -21,44 +21,44 @@ Ready for Dev
## Tasks / Subtasks ## Tasks / Subtasks
- [] **Task 1 : Créer le template navbar.php** (AC: 1, 2) - [x] **Task 1 : Créer le template navbar.php** (AC: 1, 2)
- [] Créer `templates/navbar.php` - [x] Créer `templates/navbar.php`
- [] Ajouter la structure HTML sémantique (`<header>`, `<nav>`) - [x] Ajouter la structure HTML sémantique (`<header>`, `<nav>`)
- [] Ajouter le logo/nom du site (lien vers accueil) - [x] Ajouter le logo/nom du site (lien vers accueil)
- [] Ajouter les liens de navigation desktop - [x] Ajouter les liens de navigation desktop
- [] Appliquer les classes Tailwind pour sticky + fond - [x] Appliquer les classes Tailwind pour sticky + fond
- [] **Task 2 : Implémenter le menu mobile hamburger** (AC: 3) - [x] **Task 2 : Implémenter le menu mobile hamburger** (AC: 3)
- [] Ajouter le bouton hamburger (icône 3 barres) - [x] Ajouter le bouton hamburger (icône 3 barres)
- [] Ajouter le menu mobile (overlay ou slide) - [x] Ajouter le menu mobile (overlay ou slide)
- [] Masquer le bouton sur desktop, afficher sur mobile - [x] Masquer le bouton sur desktop, afficher sur mobile
- [] Ajouter l'attribut `aria-expanded` pour l'accessibilité - [x] Ajouter l'attribut `aria-expanded` pour l'accessibilité
- [] **Task 3 : Créer le JavaScript pour le menu mobile** (AC: 3) - [x] **Task 3 : Créer le JavaScript pour le menu mobile** (AC: 3)
- [] Créer ou mettre à jour `assets/js/main.js` - [x] Créer ou mettre à jour `assets/js/main.js`
- [] Implémenter le toggle du menu (ouvert/fermé) - [x] Implémenter le toggle du menu (ouvert/fermé)
- [] Fermer le menu au clic sur un lien - [x] Fermer le menu au clic sur un lien
- [] Fermer le menu avec la touche Escape - [x] Fermer le menu avec la touche Escape
- [] Gérer l'état `aria-expanded` - [x] Gérer l'état `aria-expanded`
- [] **Task 4 : Implémenter l'état actif des liens** (AC: 4) - [x] **Task 4 : Implémenter l'état actif des liens** (AC: 4)
- [] Passer la page courante via une variable PHP - [x] Passer la page courante via une variable PHP
- [] Appliquer une classe visuelle sur le lien actif - [x] Appliquer une classe visuelle sur le lien actif
- [] Utiliser la couleur primary ou un soulignement - [x] Utiliser la couleur primary ou un soulignement
- [] **Task 5 : Rendre la navbar responsive** (AC: 5) - [x] **Task 5 : Rendre la navbar responsive** (AC: 5)
- [] Mobile : logo + hamburger uniquement - [x] Mobile : logo + hamburger uniquement
- [] Tablette/Desktop : tous les liens visibles - [x] Tablette/Desktop : tous les liens visibles
- [] Vérifier les 3 breakpoints - [x] Vérifier les 3 breakpoints
- [] **Task 6 : Ajouter l'effet au scroll** (AC: 6) - [x] **Task 6 : Ajouter l'effet au scroll** (AC: 6)
- [] Ajouter une ombre quand la page est scrollée - [x] Ajouter une ombre quand la page est scrollée
- [] Utiliser JavaScript pour détecter le scroll - [x] Utiliser JavaScript pour détecter le scroll
- [] Transition smooth pour l'effet - [x] Transition smooth pour l'effet
- [] **Task 7 : Intégrer la navbar dans les pages** - [x] **Task 7 : Intégrer la navbar dans les pages**
- [] Modifier `header.php` ou les pages pour inclure la navbar - [x] Modifier `header.php` ou les pages pour inclure la navbar
- [] Passer la variable `$currentPage` à la navbar - [x] Passer la variable `$currentPage` à la navbar
## Dev Notes ## Dev Notes
@@ -349,17 +349,18 @@ Wide (1440px) → liens visibles, centré
| Date | Version | Description | Author | | Date | Version | Description | Author |
|------|---------|-------------|--------| |------|---------|-------------|--------|
| 2026-02-04 | 0.1 | Implementation story 2.1 | Amelia |
| 2026-01-22 | 0.1 | Création initiale de la story | Sarah (PO) | | 2026-01-22 | 0.1 | Création initiale de la story | Sarah (PO) |
## Dev Agent Record ## Dev Agent Record
### Agent Model Used ### Agent Model Used
Claude Opus 4.5 (claude-opus-4-5-20251101) GPT-5 Codex
### Debug Log References ### Debug Log References
_À compléter par le dev agent_ - tests/navbar.test.ps1: navbar coverage
### Completion Notes List ### Completion Notes List
@@ -371,7 +372,8 @@ _À compléter par le dev agent_
- État actif via variable $currentPage - État actif via variable $currentPage
- Accessibilité complète (aria-expanded, aria-controls, aria-hidden) - Accessibilité complète (aria-expanded, aria-controls, aria-hidden)
- Spacer pour compenser navbar fixed - Spacer pour compenser navbar fixed
- CSS regénéré (15 Ko) - CSS régénéré via `npm run build`
- Tests: `powershell -ExecutionPolicy Bypass -File tests/run.ps1`
### File List ### File List
@@ -382,6 +384,8 @@ _À compléter par le dev agent_
| `assets/js/main.js` | Modifié (menu mobile + scroll) | | `assets/js/main.js` | Modifié (menu mobile + scroll) |
| `index.php` | Modifié (intégration navbar) | | `index.php` | Modifié (intégration navbar) |
| `assets/css/output.css` | Regénéré | | `assets/css/output.css` | Regénéré |
| `tests/navbar.test.ps1` | Créé |
| `tests/run.ps1` | Modifié |
## QA Results ## QA Results
+4
View File
@@ -7,6 +7,10 @@ include_template('header', [
'pageTitle' => 'Portfolio en construction', 'pageTitle' => 'Portfolio en construction',
'pageDescription' => 'Mon portfolio de développeur web arrive bientôt. Restez connectés !' 'pageDescription' => 'Mon portfolio de développeur web arrive bientôt. Restez connectés !'
]); ]);
include_template('navbar', [
'currentPage' => 'home'
]);
?> ?>
<main class="min-h-screen flex items-center justify-center"> <main class="min-h-screen flex items-center justify-center">
+76
View File
@@ -0,0 +1,76 @@
<?php
/**
* Template Navbar
* Variables disponibles :
* - $currentPage (string) : identifiant de la page active
*/
$currentPage = $currentPage ?? 'home';
$navLinks = [
['id' => 'home', 'label' => 'Accueil', 'url' => '/'],
['id' => 'projects', 'label' => 'Projets', 'url' => '/projets'],
['id' => 'skills', 'label' => 'Compétences', 'url' => '/competences'],
['id' => 'about', 'label' => 'Me Découvrir', 'url' => '/a-propos'],
['id' => 'contact', 'label' => 'Contact', 'url' => '/contact', 'isCta' => true],
];
?>
<header id="navbar" class="fixed top-0 left-0 right-0 z-50 bg-background/95 backdrop-blur-sm border-b border-border/50 transition-shadow duration-300">
<nav class="container-content" aria-label="Navigation principale">
<div class="flex items-center justify-between h-16 lg:h-20">
<a href="/" class="text-xl font-bold text-text-primary hover:text-primary transition-colors">
Portfolio
</a>
<ul class="hidden lg:flex items-center gap-1">
<?php foreach ($navLinks as $link): ?>
<?php if (!empty($link['isCta'])): ?>
<li class="ml-4">
<a href="<?= $link['url'] ?>" class="btn-primary text-sm">
<?= $link['label'] ?>
</a>
</li>
<?php else: ?>
<li>
<a href="<?= $link['url'] ?>"
class="nav-link <?= $currentPage === $link['id'] ? 'nav-link-active' : '' ?>">
<?= $link['label'] ?>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<button
id="mobile-menu-toggle"
class="lg:hidden p-2 text-text-primary hover:text-primary transition-colors"
aria-label="Ouvrir le menu"
aria-expanded="false"
aria-controls="mobile-menu"
>
<svg class="w-6 h-6 hamburger-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
</svg>
<svg class="w-6 h-6 close-icon hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<div id="mobile-menu" class="lg:hidden hidden" aria-hidden="true">
<ul class="py-4 space-y-2 border-t border-border">
<?php foreach ($navLinks as $link): ?>
<li>
<a href="<?= $link['url'] ?>"
class="block py-3 px-4 rounded-lg <?= $currentPage === $link['id'] ? 'bg-surface text-primary' : 'text-text-secondary hover:bg-surface hover:text-text-primary' ?> transition-colors">
<?= $link['label'] ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</nav>
</header>
<div class="h-16 lg:h-20"></div>
+25
View File
@@ -0,0 +1,25 @@
$ErrorActionPreference = 'Stop'
function Assert-True {
param(
[bool]$Condition,
[string]$Message
)
if (-not $Condition) { throw $Message }
}
Assert-True (Test-Path 'templates/navbar.php') 'Missing templates/navbar.php'
$navbar = Get-Content -Raw 'templates/navbar.php'
Assert-True ($navbar -match 'mobile-menu-toggle') 'Navbar missing toggle id'
Assert-True ($navbar -match 'nav-link-active') 'Navbar missing active class'
Assert-True (Test-Path 'assets/js/main.js') 'Missing assets/js/main.js'
$js = Get-Content -Raw 'assets/js/main.js'
Assert-True ($js -match 'initMobileMenu') 'Missing initMobileMenu'
Assert-True ($js -match 'initNavbarScroll') 'Missing initNavbarScroll'
Assert-True (Test-Path 'index.php') 'Missing index.php'
$index = Get-Content -Raw 'index.php'
Assert-True ($index -match "include_template\('navbar'") 'index.php missing navbar include'
'OK'
+1
View File
@@ -4,4 +4,5 @@ $here = Split-Path -Parent $MyInvocation.MyCommand.Path
& (Join-Path $here 'tailwind.test.ps1') & (Join-Path $here 'tailwind.test.ps1')
& (Join-Path $here 'templates.test.ps1') & (Join-Path $here 'templates.test.ps1')
& (Join-Path $here 'canary.test.ps1') & (Join-Path $here 'canary.test.ps1')
& (Join-Path $here 'navbar.test.ps1')
'OK' 'OK'