@netdata/charts
Version:
Netdata frontend SDK and chart utilities
23 lines • 783 B
JavaScript
import React, { useMemo } from "react";
import styled from "styled-components";
import { TextMicro } from "@netdata/netdata-ui";
import { useChart } from "../../provider";
import { jsx as _jsx } from "react/jsx-runtime";
var TimestampText = styled(TextMicro).withConfig({
displayName: "timestamp__TimestampText",
componentId: "sc-hewea2-0"
})(["min-width:0;"]);
var Timestamp = function Timestamp(_ref) {
var value = _ref.value;
var chart = useChart();
var text = useMemo(function () {
return "".concat(chart.formatDate(value), " \u2022 ").concat(chart.formatTime(value));
}, [value]);
return /*#__PURE__*/_jsx(TimestampText, {
truncate: true,
color: "text",
"data-testid": "chartPopover-timestamp",
children: text
});
};
export default Timestamp;