@grafana/ui
Version:
Grafana Components Library
38 lines (35 loc) • 1.16 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { css } from '@emotion/css';
import { getCellLinks, getJustifyContent } from '../utils.mjs';
;
const DataLinksCell = ({ field, rowIdx }) => {
const links = getCellLinks(field, rowIdx);
if (!(links == null ? void 0 : links.length)) {
return null;
}
return links.map((link, idx) => /* @__PURE__ */ jsx("a", { onClick: link.onClick, href: link.href, target: link.target, children: link.title }, idx));
};
const getStyles = (theme, { textWrap, textAlign }) => css({
...textWrap && {
flexDirection: "column",
justifyContent: "center",
alignItems: `${getJustifyContent(textAlign)} !important`
// we can't guarantee order, and alignItems is set on a sibling class.
},
"> a": {
flexWrap: "nowrap",
...!textWrap && {
paddingInline: theme.spacing(0.5),
borderRight: `2px solid ${theme.colors.border.medium}`,
"&:first-child": {
paddingInlineStart: 0
},
"&:last-child": {
paddingInlineEnd: 0,
borderRight: "none"
}
}
}
});
export { DataLinksCell, getStyles };
//# sourceMappingURL=DataLinksCell.mjs.map