Skip to the content

Taisen Brackets対戦

Knockout brackets as SVG, from a list of ties.

Taisen (対戦, たいせん) is Japanese for a matchup: two sides facing each other. About the name

Contents

Reference · Where every tie sits

EmblemRenderertype

A function from an emblem id and a request to an SVG string; renderEmblem of @johnmorrisdotca/dougu-sports/emblems is one.

Import it

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

Also exported from: @johnmorrisdotca/taisen-brackets

Definition

type EmblemRenderer = (id: string, options: EmblemRequest) => string;

Examples

import { drawBracket, type EmblemRenderer } from "@johnmorrisdotca/taisen-brackets";

const emblems: EmblemRenderer = () => '<svg viewBox="0 0 10 10"><circle cx="5" cy="5" r="4" fill="gold"/></svg>';
console.log(drawBracket([{ sides: ["Aurora", "Harbour"], score: [2, 1] }, { sides: ["Cascade", "Delta"], score: [0, 1] }, { sides: ["Aurora", "Delta"], score: [3, 1] }], { trophy: "trophy:cup", emblems }).startsWith("<svg"));
true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/taisen-brackets 0.20.0.