render flat delta pill for null values per design spec
This commit is contained in:
@@ -4,15 +4,15 @@ let openPdgaNumber = null;
|
||||
|
||||
// ── Delta-pill helper ─────────────────────────────
|
||||
function renderDeltaPill(value, extraClass) {
|
||||
if (value == null) return null;
|
||||
const cls = value > 0 ? 'up' : value < 0 ? 'down' : 'flat';
|
||||
const glyph = value > 0 ? '▲' : value < 0 ? '▼' : '–';
|
||||
const num = value > 0 ? '+' + value : String(value);
|
||||
const isNull = (value == null);
|
||||
const cls = isNull ? 'flat' : value > 0 ? 'up' : value < 0 ? 'down' : 'flat';
|
||||
const glyph = (isNull || value === 0) ? '–' : value > 0 ? '▲' : '▼';
|
||||
const num = isNull ? '—' : value > 0 ? '+' + value : String(value);
|
||||
return { glyph, num, cls };
|
||||
}
|
||||
|
||||
function applyDeltaPill(pillEl, value) {
|
||||
if (!pillEl || value == null) return;
|
||||
if (!pillEl) return;
|
||||
const pill = renderDeltaPill(value);
|
||||
pillEl.className = 'delta-pill ' + pill.cls;
|
||||
while (pillEl.firstChild) pillEl.removeChild(pillEl.firstChild);
|
||||
|
||||
Reference in New Issue
Block a user