/** * SchoolCard Component * Displays school information with metrics and actions */ import Link from 'next/link'; import type { School } from '@/lib/types'; import { formatPercentage, formatProgress, calculateTrend, getTrendColor } from '@/lib/utils'; import styles from './SchoolCard.module.css'; interface SchoolCardProps { school: School; onAddToCompare?: (school: School) => void; showDistance?: boolean; distance?: number; } export function SchoolCard({ school, onAddToCompare, showDistance, distance }: SchoolCardProps) { const trend = calculateTrend(school.rwm_expected_pct, school.prev_rwm_expected_pct); const trendColor = getTrendColor(trend); return (

{school.school_name}

{showDistance && distance !== undefined && ( {distance.toFixed(1)} km away )}
{school.local_authority && ( {school.local_authority} )} {school.school_type && ( {school.school_type} )} {school.religious_denomination && school.religious_denomination !== 'Does not apply' && ( {school.religious_denomination} )}
{(school.rwm_expected_pct !== null || school.reading_progress !== null) && (
{school.rwm_expected_pct !== null && (
RWM Expected
{formatPercentage(school.rwm_expected_pct)} {school.prev_rwm_expected_pct !== null && ( {trend === 'up' ? '↑' : trend === 'down' ? '↓' : '→'} )}
)} {school.reading_progress !== null && (
Reading Progress {formatProgress(school.reading_progress)}
)} {school.writing_progress !== null && (
Writing Progress {formatProgress(school.writing_progress)}
)} {school.maths_progress !== null && (
Maths Progress {formatProgress(school.maths_progress)}
)}
)}
View Details {onAddToCompare && ( )}
); }