Reference · Draw a bracket, a table or a road to the final
RankingOptionstype
What a ranking can be told: the style (podium, list or featured), rows and page, columns, movement arrows, name and rank style, and the size, theme and language.
Import it
import type { RankingOptions } from "@johnmorrisdotca/taisen-brackets";
Definition
interface RankingOptions extends BoardOptions {
style?: "podium" | "list" | "featured";
big?: number;
columns?: 1 | 2;
rows?: number;
page?: number;
split?: boolean;
medals?: boolean;
movement?: "arrow" | "row" | "both" | "none";
nameStyle?: "surname-first" | "given-first" | "as-is";
rankStyle?: "plain" | "hash";
precision?: number;
ties?: boolean;
sort?: "given" | "points";
categories?: boolean;
badge?: boolean;
}
Members
| Name | Type | Description |
|---|---|---|
style (optional) | "podium" | "list" | "featured" | undefined |
|
big (optional) | number | undefined | How many rows, from the top, are big (0 to 3). Default by |
columns (optional) | 2 | 1 | undefined | One column or two for the compact rows (the first column runs down before the second starts). Default 1, and 2 for |
rows (optional) | number | undefined | The most entries drawn, from the first of the page. Default: as many as fit at a readable size. |
page (optional) | number | undefined | Which page of |
split (optional) | boolean | undefined | On a wide board (at least 3:2) the big rows go in a panel on the left and the compact ones beside them, in place of one above the other. Default true; |
medals (optional) | boolean | undefined | Tint the rows of ranks 1 to 3 gold, silver and bronze. Default: on for |
movement (optional) | "none" | "arrow" | "row" | "both" | undefined | How movement is shown: |
nameStyle (optional) | "surname-first" | "given-first" | "as-is" | undefined |
|
rankStyle (optional) | "plain" | "hash" | undefined |
|
precision (optional) | number | undefined | Decimals for numeric points ( |
ties (optional) | boolean | undefined | Equal points share a rank where an entry names none ( |
sort (optional) | "points" | "given" | undefined |
|
categories (optional) | boolean | undefined | Write each entry's own |
badge (optional) | boolean | undefined | Draw a club's (or the athlete's) initials on a badge for an entry with no flag or mark, even where no entry has one. Default: only where some entry has a flag or mark. |
size (optional) | BoardSizeName | { width: number; height: number; } | undefined | One of |
theme (optional) | "auto" | "light" | "dark" | undefined |
|
flags (optional) | FlagRenderer | undefined | Draws a flag from its code, as for |
flagHref (optional) | ((code: string) => string | null | undefined) | undefined | The address of a flag as a picture to load, tried where |
flagShape (optional) | "round" | "square" | undefined |
|
locale (optional) | string | Locale | undefined | The language: |
words (optional) | Partial<Words> | undefined | |
title (optional) | string | undefined | The |
id (optional) | string | undefined | Prefix for the drawing's ids. Default: a hash of the state and the options. |
className (optional) | string | undefined |
Examples
import { rankingList, type RankingOptions } from "@johnmorrisdotca/taisen-brackets";
const options: RankingOptions = { style: "list", precision: 2, size: "portrait", movement: "arrow" };
console.log(rankingList({ entries: [
{ name: { surname: "Nakamura", given: "Kenji" }, club: "Coastal Pine Judo", flag: "CA-BC", points: 412.5, change: 1 },
{ name: { surname: "Brar", given: "Harpreet" }, club: "Salmonberry Judo Club", flag: "CA-BC", points: 398, change: -1 },
{ name: { surname: "Leclerc", given: "Mathieu" }, club: "Kestrel Valley Judo", flag: "CA-QC", points: 366.25, change: 4 },
] }, options).includes("412.50"));trueWhat it prints (run when this page was built)