本文へ移動

Taisen Brackets対戦

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

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

目次

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

rankingNumberOnes関数

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

The number ones as cards in a grid: a coloured panel with the 1, the flag, the name and the club or country, the points and a pill that says "#1 in -57 kg". Throws a RangeError for no cards, a card with no category, an entry with no name, a colour that is not a hex code, columns that are not 1 to 4, or a bad size or theme.

インポート

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

定義

function rankingNumberOnes(source: NumberOnesSource, options?: NumberOnesOptions): string

引数

名前型説明
sourceNumberOnesSource

The cards.

options (省略可)NumberOnesOptions

The columns, the colours, the size, the theme and the language.

戻り値

string

The SVG, a string that begins with <svg.

例

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

const svg = rankingNumberOnes({
  date: "October 2026",
  cards: [
    { category: "-60 kg", entry: { name: { surname: "Nakamura", given: "Kenji" }, club: "Coastal Pine Judo", flag: "CA-BC", points: 1240 } },
    { category: "-66 kg", entry: { name: { surname: "Leclerc", given: "Mathieu" }, club: "Kestrel Valley Judo", flag: "CA-QC", points: 1175 } },
  ],
}, { size: "square" });
console.log(svg.includes("#1 in -66 kg"), svg.includes("LECLERC Mathieu"));
true true

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

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

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