feat(row): redesign to clean 3-line layout with stats on second row
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 32s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m6s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s

Line 1: school name (bold) + school type (muted gray)
Line 2: R,W&M %  ·  Progress score + band  ·  Pupil count
Line 3: local authority  ·  distance (location searches)

Actions (View / Add) are vertically centred on the right across all lines.
Progress uses reading score, falling back to writing then maths. Removed
the old nameScore grouping and separate meta/progress rows in favour of
the cleaner 3-line structure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 09:27:22 +00:00
parent a11e322017
commit c49593d4d6
2 changed files with 171 additions and 237 deletions

View File

@@ -1,10 +1,12 @@
.row {
display: flex;
align-items: center;
gap: 1rem;
background: var(--bg-card, white);
border: 1px solid var(--border-color, #e5dfd5);
border-left: 3px solid transparent;
border-radius: 8px;
padding: 0.875rem 1rem;
padding: 0.75rem 1rem;
transition: border-color 0.15s ease, box-shadow 0.15s ease;
animation: rowFadeIn 0.3s ease-out both;
}
@@ -20,37 +22,24 @@
}
@keyframes rowFadeIn {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
.rowMain {
/* ── Left content column ─────────────────────────────── */
.rowContent {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 0.3rem;
gap: 0.2rem;
}
/* Line 1: name+score on the left, actions pinned right */
.rowTop {
display: flex;
align-items: center;
gap: 1rem;
}
/* Name + score grouped together on the left */
.nameScore {
/* Line 1: name + type */
.line1 {
display: flex;
align-items: baseline;
gap: 0.75rem;
flex: 1;
gap: 0.625rem;
min-width: 0;
}
@@ -62,65 +51,89 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
flex-shrink: 1;
min-width: 0;
}
.schoolName:hover {
color: var(--accent-coral, #e07256);
}
/* Score block: value + label inline */
.scoreBlock {
display: flex;
align-items: baseline;
gap: 0.3rem;
flex-shrink: 0;
.schoolType {
font-size: 0.8rem;
color: var(--text-muted, #8a847a);
white-space: nowrap;
flex-shrink: 0;
}
.scoreValue {
font-size: 1.0625rem;
/* Line 2: stats */
.line2 {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0 1.25rem;
}
.stat {
display: inline-flex;
align-items: baseline;
gap: 0.3rem;
}
.statValue {
font-size: 0.9375rem;
font-weight: 700;
color: var(--text-primary, #1a1612);
font-family: var(--font-playfair), 'Playfair Display', serif;
line-height: 1.2;
display: flex;
display: inline-flex;
align-items: center;
gap: 0.2rem;
}
.scoreNA {
font-size: 1rem;
color: var(--text-muted, #8a847a);
}
.scoreLabel {
.statLabel {
font-size: 0.75rem;
color: var(--text-muted, #8a847a);
white-space: nowrap;
}
/* Trend arrow */
/* Trend arrows */
.trend {
display: inline-flex;
align-items: center;
margin-left: 2px;
margin-left: 1px;
}
.trendUp {
color: var(--accent-teal, #2d7d7d);
}
.trendUp { color: var(--accent-teal, #2d7d7d); }
.trendDown { color: var(--accent-coral, #e07256); }
.trendStable { color: var(--text-muted, #8a847a); }
.trendDown {
color: var(--accent-coral, #e07256);
}
.trendStable {
/* Line 3: location */
.line3 {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0 0;
font-size: 0.8rem;
color: var(--text-muted, #8a847a);
}
/* Action buttons — pinned right, slightly larger on desktop */
.line3 span:not(:last-child)::after {
content: '·';
margin: 0 0.4rem;
color: var(--border-color, #e5dfd5);
}
.distanceBadge {
display: inline-block;
padding: 0.0625rem 0.375rem;
font-size: 0.75rem;
font-weight: 600;
background: var(--accent-teal, #2d7d7d);
color: white;
border-radius: 3px;
}
/* ── Right actions column ────────────────────────────── */
.rowActions {
display: flex;
align-items: center;
@@ -128,7 +141,7 @@
flex-shrink: 0;
}
/* Equalise <a> and <button> rendering */
/* Equalise <a> and <button> */
.rowActions > * {
height: 2rem;
line-height: 1;
@@ -198,102 +211,33 @@
color: var(--text-primary, #1a1612);
}
/* Line 2: Meta tags */
.rowMeta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.25rem 0;
font-size: 0.8rem;
color: var(--text-muted, #8a847a);
}
.rowMeta span:not(:last-child)::after {
content: '·';
margin: 0 0.4rem;
color: var(--border-color, #e5dfd5);
}
.distanceBadge {
display: inline-block;
padding: 0.0625rem 0.375rem;
font-size: 0.75rem;
font-weight: 600;
background: var(--accent-teal, #2d7d7d);
color: white;
border-radius: 3px;
margin-left: 0.25rem;
}
/* Line 3: Progress scores */
.rowProgress {
display: flex;
flex-wrap: wrap;
gap: 0.25rem 1rem;
margin-top: 0.125rem;
}
.progressItem {
font-size: 0.8rem;
color: var(--text-secondary, #5c564d);
}
.progressValue {
color: var(--text-primary, #1a1612);
margin: 0 0.25rem;
}
.progressBand {
font-style: normal;
font-size: 0.75rem;
color: var(--text-muted, #8a847a);
}
/* Mobile */
/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 640px) {
.row {
padding: 0.75rem;
border-radius: 6px;
}
.rowTop {
flex-wrap: wrap;
gap: 0.5rem;
padding: 0.75rem;
gap: 0.625rem;
}
/* School name takes full width, score+actions wrap below */
.nameScore {
.rowContent {
flex-basis: 100%;
min-width: 0;
}
.schoolName {
white-space: normal;
}
/* Score block stays inline with label visible */
.scoreBlock {
align-items: baseline;
.line2 {
gap: 0 1rem;
}
.scoreLabel {
font-size: 0.7rem;
}
/* Actions move to end of the wrapped row */
.rowActions {
margin-left: auto;
width: 100%;
gap: 0.375rem;
}
.btnView,
.btnCompare,
.btnRemove {
padding: 0.4375rem 0.875rem;
font-size: 0.875rem;
}
.rowProgress {
gap: 0.375rem 0.75rem;
.rowActions > * {
flex: 1;
justify-content: center;
}
}

View File

@@ -1,6 +1,10 @@
/**
* SchoolRow Component
* Compact row-based school display for search results list view
* Three-line row for school search results
*
* Line 1: School name · School type
* Line 2: R,W&M % · Progress score · Pupil count
* Line 3: Local authority · Distance
*/
import type { School } from '@/lib/types';
@@ -25,10 +29,9 @@ export function SchoolRow({
}: SchoolRowProps) {
const trend = calculateTrend(school.rwm_expected_pct, school.prev_rwm_expected_pct);
const hasProgress =
school.reading_progress != null ||
school.writing_progress != null ||
school.maths_progress != null;
// Use reading progress as representative; fall back to writing, then maths
const progressScore =
school.reading_progress ?? school.writing_progress ?? school.maths_progress ?? null;
const handleCompareClick = () => {
if (isInCompare) {
@@ -40,18 +43,24 @@ export function SchoolRow({
return (
<div className={`${styles.row} ${isInCompare ? styles.rowInCompare : ''}`}>
<div className={styles.rowMain}>
{/* Line 1: Name + score on left, actions pinned right */}
<div className={styles.rowTop}>
<div className={styles.nameScore}>
{/* Left: three content lines */}
<div className={styles.rowContent}>
{/* Line 1: School name + type */}
<div className={styles.line1}>
<a href={`/school/${school.urn}`} className={styles.schoolName}>
{school.school_name}
</a>
{school.school_type && (
<span className={styles.schoolType}>{school.school_type}</span>
)}
</div>
<div className={styles.scoreBlock}>
{/* Line 2: Key stats */}
<div className={styles.line2}>
{school.rwm_expected_pct != null ? (
<>
<strong className={styles.scoreValue}>
<span className={styles.stat}>
<strong className={styles.statValue}>
{formatPercentage(school.rwm_expected_pct, 0)}
</strong>
{school.prev_rwm_expected_pct != null && (
@@ -60,30 +69,68 @@ export function SchoolRow({
title={`Previous year: ${formatPercentage(school.prev_rwm_expected_pct)}`}
>
{trend === 'up' && (
<svg viewBox="0 0 16 16" fill="none" width="10" height="10">
<svg viewBox="0 0 16 16" fill="none" width="9" height="9">
<path d="M8 3L14 10H2L8 3Z" fill="currentColor" />
</svg>
)}
{trend === 'down' && (
<svg viewBox="0 0 16 16" fill="none" width="10" height="10">
<svg viewBox="0 0 16 16" fill="none" width="9" height="9">
<path d="M8 13L2 6H14L8 13Z" fill="currentColor" />
</svg>
)}
{trend === 'stable' && (
<svg viewBox="0 0 16 16" fill="none" width="10" height="10">
<svg viewBox="0 0 16 16" fill="none" width="9" height="9">
<rect x="2" y="7" width="12" height="2" rx="1" fill="currentColor" />
</svg>
)}
</span>
)}
</>
<span className={styles.statLabel}>R, W &amp; M</span>
</span>
) : (
<span className={styles.scoreNA}></span>
<span className={styles.stat}>
<strong className={styles.statValue}></strong>
<span className={styles.statLabel}>R, W &amp; M</span>
</span>
)}
{progressScore != null && (
<span className={styles.stat}>
<strong className={styles.statValue}>{formatProgress(progressScore)}</strong>
<span className={styles.statLabel}>
progress · {progressBand(progressScore)}
</span>
</span>
)}
{school.total_pupils != null && (
<span className={styles.stat}>
<strong className={styles.statValue}>{school.total_pupils.toLocaleString()}</strong>
<span className={styles.statLabel}>pupils</span>
</span>
)}
<span className={styles.scoreLabel}>R, W &amp; M</span>
</div>
</div>
{/* Line 3: Location + distance */}
<div className={styles.line3}>
{school.local_authority && (
<span>{school.local_authority}</span>
)}
{isLocationSearch && school.distance != null && (
<span className={styles.distanceBadge}>
{school.distance.toFixed(1)} mi
</span>
)}
{!isLocationSearch &&
school.religious_denomination &&
school.religious_denomination !== 'Does not apply' && (
<span>{school.religious_denomination}</span>
)}
</div>
</div>
{/* Right: actions, vertically centred */}
<div className={styles.rowActions}>
<a href={`/school/${school.urn}`} className={styles.btnView}>
View
@@ -98,62 +145,5 @@ export function SchoolRow({
)}
</div>
</div>
{/* Line 2: Meta tags */}
<div className={styles.rowMeta}>
{school.local_authority && <span>{school.local_authority}</span>}
{school.school_type && <span>{school.school_type}</span>}
{!isLocationSearch &&
school.religious_denomination &&
school.religious_denomination !== 'Does not apply' && (
<span>{school.religious_denomination}</span>
)}
{isLocationSearch && school.distance != null && (
<span className={styles.distanceBadge}>
{school.distance.toFixed(1)} mi
</span>
)}
</div>
{/* Line 3: Progress scores with plain-language bands */}
{hasProgress && (
<div className={styles.rowProgress}>
{school.reading_progress != null && (
<span className={styles.progressItem}>
Reading{' '}
<strong className={styles.progressValue}>
{formatProgress(school.reading_progress)}
</strong>
<em className={styles.progressBand}>
{progressBand(school.reading_progress)}
</em>
</span>
)}
{school.writing_progress != null && (
<span className={styles.progressItem}>
Writing{' '}
<strong className={styles.progressValue}>
{formatProgress(school.writing_progress)}
</strong>
<em className={styles.progressBand}>
{progressBand(school.writing_progress)}
</em>
</span>
)}
{school.maths_progress != null && (
<span className={styles.progressItem}>
Maths{' '}
<strong className={styles.progressValue}>
{formatProgress(school.maths_progress)}
</strong>
<em className={styles.progressBand}>
{progressBand(school.maths_progress)}
</em>
</span>
)}
</div>
)}
</div>
</div>
);
}