Files
school_compare/nextjs-app/components/Navigation.tsx
Tudor 8aca0a7a53
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 35s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m10s
Build and Push Docker Images / Build Integrator (push) Successful in 57s
Build and Push Docker Images / Build Kestra Init (push) Successful in 31s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
feat(ui): site-wide UX/UI audit — unified buttons, tokens, accessibility
- Add shared button system (.btn-primary/secondary/tertiary/active) in globals.css
- Replace 40+ hardcoded rgba() values with design tokens across all CSS modules
- Add skip link, :focus-visible indicators, and ARIA landmarks
- Standardise button labels ("+ Compare" / "✓ Comparing") across all components
- Add collapse/minimize toggle to ComparisonToast
- Fix heading hierarchy (h3→h2 in ComparisonView)
- Add aria-live on search results, aria-label on trend SVGs
- Add "Search" nav link, fix footer empty section, unify max-widths
- Darken --text-muted for WCAG AA compliance (4.6:1 contrast ratio)
- Net reduction of ~180 lines through button style deduplication

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 20:28:03 +00:00

67 lines
2.0 KiB
TypeScript

/**
* Navigation Component
* Main navigation header with active link highlighting
*/
'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useComparison } from '@/hooks/useComparison';
import styles from './Navigation.module.css';
export function Navigation() {
const pathname = usePathname();
const { selectedSchools } = useComparison();
const isActive = (path: string) => {
if (path === '/') {
return pathname === '/';
}
return pathname.startsWith(path);
};
return (
<header className={styles.header}>
<div className={styles.container}>
<Link href="/" className={styles.logo}>
<div className={styles.logoIcon}>
<svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="20" cy="20" r="18" stroke="currentColor" strokeWidth="2"/>
<path d="M20 6L20 34M8 14L32 14M6 20L34 20M8 26L32 26" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/>
<circle cx="20" cy="20" r="3" fill="currentColor"/>
</svg>
</div>
<span className={styles.logoText}>SchoolCompare</span>
</Link>
<nav className={styles.nav} aria-label="Main navigation">
<Link
href="/"
className={isActive('/') ? `${styles.navLink} ${styles.active}` : styles.navLink}
>
Search
</Link>
<Link
href="/compare"
className={isActive('/compare') ? `${styles.navLink} ${styles.active}` : styles.navLink}
>
Compare
{selectedSchools.length > 0 && (
<span key={selectedSchools.length} className={styles.badge}>
{selectedSchools.length}
</span>
)}
</Link>
<Link
href="/rankings"
className={isActive('/rankings') ? `${styles.navLink} ${styles.active}` : styles.navLink}
>
Rankings
</Link>
</nav>
</div>
</header>
);
}