fix(web): align bracket score-card row geometry
This commit is contained in:
1 parent
c9140b8622
commit
61f1db0e6a
2 files changed
+45
-1
No files matched your search
@@ -104,7 +104,11 @@ export function SeriesScoreCard({
|
|||||||
{presentation.label}
|
{presentation.label}
|
||||||
</span>
|
</span>
|
||||||
</header>
|
</header>
|
||||||
<div className="divide-y divide-base-content/8">
|
<div
|
||||||
|
className={
|
||||||
|
isBracket ? "relative" : "divide-y divide-base-content/8"
|
||||||
|
}
|
||||||
|
>
|
||||||
{series.entries.map((entry) => {
|
{series.entries.map((entry) => {
|
||||||
const team = entry.teamId ? teamById.get(entry.teamId) : undefined;
|
const team = entry.teamId ? teamById.get(entry.teamId) : undefined;
|
||||||
const isWinner = isSeriesEntryWinner(series, entry.teamId);
|
const isWinner = isSeriesEntryWinner(series, entry.teamId);
|
||||||
@@ -129,6 +133,13 @@ export function SeriesScoreCard({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{isBracket && (
|
||||||
|
<span
|
||||||
|
className="pointer-events-none absolute inset-x-0 border-t border-base-content/8"
|
||||||
|
style={{ top: SERIES_SCORE_CARD_GEOMETRY.entryHeight }}
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { readFile } from "node:fs/promises";
|
||||||
|
import test from "node:test";
|
||||||
|
import { SERIES_SCORE_CARD_GEOMETRY } from "../src/components/competition/series-score-card-geometry.ts";
|
||||||
|
|
||||||
|
const component = await readFile(
|
||||||
|
new URL(
|
||||||
|
"../src/components/competition/SeriesScoreCard.tsx",
|
||||||
|
import.meta.url,
|
||||||
|
),
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
|
||||||
|
test("keeps bracket entry rows equal by overlaying their divider", () => {
|
||||||
|
assert.equal(
|
||||||
|
SERIES_SCORE_CARD_GEOMETRY.height -
|
||||||
|
SERIES_SCORE_CARD_GEOMETRY.borderWidth * 2 -
|
||||||
|
SERIES_SCORE_CARD_GEOMETRY.headerHeight,
|
||||||
|
SERIES_SCORE_CARD_GEOMETRY.entryHeight * 2,
|
||||||
|
);
|
||||||
|
assert.match(
|
||||||
|
component,
|
||||||
|
/className=\{\s*isBracket\s*\?\s*"relative"\s*:\s*"divide-y divide-base-content\/8"\s*\}/,
|
||||||
|
);
|
||||||
|
assert.match(
|
||||||
|
component,
|
||||||
|
/className="pointer-events-none absolute inset-x-0 border-t border-base-content\/8"/,
|
||||||
|
);
|
||||||
|
assert.match(
|
||||||
|
component,
|
||||||
|
/style=\{\{ top: SERIES_SCORE_CARD_GEOMETRY\.entryHeight \}\}/,
|
||||||
|
);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user