Skip to content

Commit

Permalink
fix: 🚸 recognize empty string as valid seedValue
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeTennis committed Jun 3, 2024
1 parent 6e82e7e commit 4529d0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/components/renderSeeding.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export function renderSeeding({ className, composition, side }) {
const seedValue = side?.seedValue || side?.seedNumber;
const seedValue = side?.seedValue !== undefined ? side.seedValue : side?.seedNumber;

if (!seedValue) return "";
if (!seedValue) return '';

const configuration = composition?.configuration || {};
const { bracketedSeeds } = configuration;

const brackets = (typeof bracketedSeeds === "boolean" && ["(", ")"]) ||
(bracketedSeeds === "square" && ["[", "]"]) || ["", ""];
const brackets = (typeof bracketedSeeds === 'boolean' && ['(', ')']) ||
(bracketedSeeds === 'square' && ['[', ']']) || ['', ''];
const seedDisplay = `${brackets[0]}${seedValue}${brackets[1]}`;

const element = configuration.seedingElement === "sup" ? "sup" : "span";
const element = configuration.seedingElement === 'sup' ? 'sup' : 'span';
const sup = document.createElement(element);
sup.className = className;
sup.innerHTML = seedDisplay;
Expand Down
4 changes: 2 additions & 2 deletions src/stories/structure.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const eventHandlers = {
const composition = {
configuration: {
bracketedSeeds: 'square',
flags: true,
showAddress: true
showAddress: true,
flags: true
}
};
const participants = matchUp.sides.map(({ participant }) => participant);
Expand Down

0 comments on commit 4529d0f

Please sign in to comment.