From 6c6428e525661796709389c9405adda172ab941b Mon Sep 17 00:00:00 2001 From: Alexandr Andreyev Date: Fri, 15 Aug 2025 22:50:13 +0300 Subject: [PATCH] add pitch circles --- fab-ui/src/enums.ts | 21 +++++++++++++++++++ fab-ui/src/fab-card-title.ts | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 fab-ui/src/enums.ts diff --git a/fab-ui/src/enums.ts b/fab-ui/src/enums.ts new file mode 100644 index 0000000..ddcb9f8 --- /dev/null +++ b/fab-ui/src/enums.ts @@ -0,0 +1,21 @@ + +export const FabCardColor = { + RED: "Red", + YELLOW: "Yellow", + BLUE: "Blue", +} as const; + +export function colorToNumber(color: typeof FabCardColor[keyof typeof FabCardColor]): number { + switch (color) { + case FabCardColor.RED: + return 1; + case FabCardColor.YELLOW: + return 2; + case FabCardColor.BLUE: + return 3; + default: + return 0; + } +} + +// export type FabCardColor = typeof FabCardColor[keyof typeof FabCardColor]; \ No newline at end of file diff --git a/fab-ui/src/fab-card-title.ts b/fab-ui/src/fab-card-title.ts index e94bf09..71b9b95 100644 --- a/fab-ui/src/fab-card-title.ts +++ b/fab-ui/src/fab-card-title.ts @@ -1,5 +1,43 @@ import { LitElement, css, html } from 'lit' import { customElement, property } from 'lit/decorators.js' +import { FabCardColor, colorToNumber } from './enums'; + +@customElement("fab-pitch-circles") +export class FabPitchCircles extends LitElement { + static SYMBOL = '●️'; + + @property({ type: FabCardColor }) + color = null; + + render() { + let num: number; + if (this.color !== null) { + num = colorToNumber(this.color); + } else { + num = 0; + } + return html` + + ${FabPitchCircles.SYMBOL.repeat(num)} + + `; + } + + static styles = css` + .pitch-circles { + display: inline-block; + } + .pitch-circles-red { + color: red; + } + .pitch-circles-yellow { + color: #FFD600; + } + .pitch-circles-blue { + color: blue; + } + `; +} @customElement("fab-rarity-symbol") export class FabRaritySymbol extends LitElement { @@ -94,6 +132,7 @@ export class FabCardTitle extends LitElement { ${this.name} (${this.color}) ${this.foiling == "S" ? '' : this.foiling } + `;