@grafana/flamegraph
Version:
Grafana flamegraph visualization component
29 lines (24 loc) • 846 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
;
function DiffCell({ value, theme }) {
if (value === void 0) {
return /* @__PURE__ */ jsxRuntime.jsx("span", { children: "-" });
}
let displayValue;
let color;
if (value === Infinity) {
displayValue = "new";
color = theme.colors.success.text;
} else if (value === -100) {
displayValue = "removed";
color = theme.colors.error.text;
} else {
displayValue = `${value > 0 ? "+" : ""}${value.toFixed(2)}%`;
color = value > 0 ? theme.colors.error.text : theme.colors.success.text;
}
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color, fontWeight: "bold" }, children: displayValue });
}
exports.DiffCell = DiffCell;
//# sourceMappingURL=DiffCell.cjs.map