Reference · Draw a bracket, a table or a road to the final
BroadcastMedalOptionstype
What a broadcast medal table can be told: labels (the codes or the names), ranks, the sort and the rows, and the options of every broadcast board.
Import it
import type { BroadcastMedalOptions } from "@johnmorrisdotca/taisen-brackets";
Definition
interface BroadcastMedalOptions extends BroadcastOptions, Pick<MedalTableOptions, "sort" | "ties" | "top" | "skipEmpty"> {
labels?: "code" | "name";
ranks?: boolean;
}
Members
| Name | Type | Description |
|---|---|---|
labels (optional) | "name" | "code" | undefined | Write each row's |
ranks (optional) | boolean | undefined | Write the rank before each row. Default true. |
width (optional) | number | undefined | The width of the board; the height follows from the rows. Default 1280, from 320 to 4000. |
look (optional) | BroadcastLook | undefined |
|
icon (optional) | BroadcastIcon | undefined | The icon in the square at the left of the title: |
iconMark (optional) | string | undefined | A mark of your own for that square (inline SVG or an image address), in place of |
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 |
locale (optional) | string | Locale | undefined | |
words (optional) | Partial<Words> | undefined | |
title (optional) | string | undefined | The |
id (optional) | string | undefined | |
className (optional) | string | undefined | |
ties (optional) | boolean | undefined | Equal rows share a rank ( |
sort (optional) | "given" | "gold" | "total" | undefined |
|
top (optional) | number | undefined | Only the first N rows, after sorting. |
skipEmpty (optional) | boolean | undefined | Hide the rows with no medal at all. Default false. |
Examples
import { broadcastMedalTable, type BroadcastMedalOptions } from "@johnmorrisdotca/taisen-brackets";
const options: BroadcastMedalOptions = { width: 960, labels: "name", ranks: true };
console.log(broadcastMedalTable({ subtitle: "Day 16", rows: [
{ name: "United States", code: "USA", flag: "US", gold: 46, silver: 29, bronze: 29 },
{ name: "China", code: "CHN", flag: "CN", gold: 38, silver: 27, bronze: 22 },
] }, options).startsWith("<svg"));trueWhat it prints (run when this page was built)