/** * 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, schoolUrl } from '@/lib/utils'; import styles from './SchoolCard.module.css'; interface SchoolCardProps { school: School; onAddToCompare?: (school: School) => void; onRemoveFromCompare?: (urn: number) => void; showDistance?: boolean; distance?: number; isInCompare?: boolean; } export function SchoolCard({ school, onAddToCompare, onRemoveFromCompare, showDistance, distance, isInCompare = false }: 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 / 1.60934).toFixed(1)} miles 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.attainment_8_score != null || school.reading_progress !== null) && (
{/* KS4 card metrics for secondary schools */} {school.attainment_8_score != null && (
Attainment 8 avg grade across best 8 GCSEs
{school.attainment_8_score.toFixed(1)}
)} {school.english_maths_standard_pass_pct != null && (
English & Maths Grade 4+ % standard pass in both
{formatPercentage(school.english_maths_standard_pass_pct)}
)} {school.rwm_expected_pct !== null && (
Reading, Writing & Maths % meeting expected standard
{formatPercentage(school.rwm_expected_pct)} {school.prev_rwm_expected_pct !== null && ( {trend === 'up' && ( )} {trend === 'down' && ( )} {trend === 'stable' && ( )} )}
)} {school.reading_progress !== null && (
Reading progress score (0 = avg) {formatProgress(school.reading_progress)}
)} {school.writing_progress !== null && (
Writing progress score (0 = avg) {formatProgress(school.writing_progress)}
)} {school.maths_progress !== null && (
Maths progress score (0 = avg) {formatProgress(school.maths_progress)}
)}
)}
View Details {onAddToCompare && ( )}
); }