@netdata/charts
Version:
Netdata frontend SDK and chart utilities
37 lines • 1.22 kB
JavaScript
import React from "react";
import { TextSmall } from "@netdata/netdata-ui";
import { useChart, useAttributeValue, useTitle } from "../provider";
import Row from "./row";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var ChartDescription = function ChartDescription() {
var title = useTitle();
var info = useAttributeValue("info");
var sectionInfo = useAttributeValue("sectionInfo");
var chart = useChart();
var onClick = function onClick(event) {
var _event$target$hash = event.target.hash,
hash = _event$target$hash === void 0 ? "" : _event$target$hash;
if (!hash.startsWith("#menu")) return;
event.preventDefault();
chart.sdk.trigger("goToLink", chart, hash.substr(1));
};
return /*#__PURE__*/_jsxs(Row, {
title: title,
color: "key",
"data-testid": "cartDetails-description",
children: [/*#__PURE__*/_jsx(TextSmall, {
color: "textDescription",
dangerouslySetInnerHTML: {
__html: sectionInfo
},
onClick: onClick
}), /*#__PURE__*/_jsx(TextSmall, {
color: "textDescription",
dangerouslySetInnerHTML: {
__html: info
},
onClick: onClick
})]
});
};
export default ChartDescription;