本文へ移動

Taisen Brackets対戦

対戦の一覧から、トーナメント表をSVGで描きます。

対戦(たいせん)は、二者が向かい合って勝負することです。 名前について(英語)

目次

リファレンス · トーナメント表・表・決勝までの道を描く

ResultsBoardSource型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

A results board to draw: the title, the phase, the columns and the rows.

インポート

import type { ResultsBoardSource } from "@johnmorrisdotca/taisen-brackets";

定義

interface ResultsBoardSource {
    title: string;
    phase?: string;
    columns?: readonly ResultsColumn[];
    rows: readonly ResultsRow[];
}

メンバー

名前型説明
titlestring

The event, in capitals in the title band ("Women's apparatus final").

phase (省略可)string | undefined

The phase in the sub bar ("Result", "Final", "Preliminaries"). Default: the language's "Result".

columns (省略可)readonly ResultsColumn[] | undefined

The score columns, left to right. Default: one column per value of the longest row, with no heading.

rowsreadonly ResultsRow[]

例

import { resultsBoard, type ResultsBoardSource } from "@johnmorrisdotca/taisen-brackets";

const source: ResultsBoardSource = {
  title: "Men's 100m butterfly",
  phase: "Results · Final",
  columns: [{ precision: 2 }],
  rows: [
    { code: "USA", flag: "US", name: "Michael Phillips", values: [50.58], record: "OR" },
    { code: "HUN", flag: "HU", name: "Laszlo Czigany", values: [50.59] },
  ],
};
console.log(resultsBoard(source).includes("50.58"));
true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/taisen-brackets 0.20.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。