Skip to content

Block 180 of 297

League Standings

Division standings tables that compute winning percentage and games behind, sort teams, and add rain-out info.

Puck key
LeagueStandingsBlock
Export
leagueStandingsBlock
React component
<LeagueStandings />
Path
components/puck/league-standings-block.tsx
Dependencies
None
License
MIT

About this block

When to use it, how to write for it, and what to change in the code.

What it's for

League standings with one table per division. Editors type wins, losses, ties and a streak; the block calculates winning percentage and games behind and sorts teams itself, marking the leader. With more than one division, a row of jump links appears under the heading. Tables scroll sideways on narrow phones, and a rain-out box can follow.

  • Youth or adult rec league standings pages
  • A league hub page with several age divisions
  • End-of-season standings for a tournament or jamboree
Writing the content
  • Enter Wins, Losses and Ties as whole numbers. Winning percentage counts a tie as half a win, and teams are ranked by it automatically.
  • Type Streak as W, L or T plus a number, like W3; anything else shows as written.
  • Update Standings as of every time you enter results, like "Through games of Oct 7".
  • Each division holds 1 to 24 teams, and you can add up to 12 divisions.
Accessibility
  • Column headers like PCT and GB are abbr elements with the full name read to screen readers ("Winning percentage", "Games behind the leader") (WCAG 1.3.1).
  • Streaks read as phrases such as "Won 4 in a row", and dashes read as "Leader", "No games yet" or "No streak".
  • Each table has a hidden caption naming league, season and division, inside a focusable scroll region (WCAG 2.1.1).
Customizing the code
  • Sort order and the games-behind formula live in the tables map in render; formatPct and formatGb control the display.
  • Columns are defined in the columns constant, and the leader row uses bg-indigo-50/60.

Editor fields

What content editors see in the P1 sidebar when they select this block.

  • Leaguetext
  • Seasontext
  • Headingtext
  • Heading levelselect
  • Introtextarea
  • Standings as oftext
  • Divisionsarray
  • Schedule link texttext
  • Schedule linktext
  • Rain-out titletext
  • Rain-out detailstextarea
  • Rain-out phonetext