@grafana/ui
Version:
Grafana Components Library
43 lines (40 loc) • 1.41 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { css } from '@emotion/css';
import '@grafana/data';
import { useStyles2 } from '../../../../themes/ThemeContext.mjs';
import 'micro-memoize';
import '@emotion/react';
import 'tinycolor2';
import '../../../../utils/skeleton.mjs';
import { getCellLinks } from '../utils.mjs';
const DataLinksCell = ({ field, rowIdx }) => {
const styles = useStyles2(getStyles);
const links = getCellLinks(field, rowIdx);
return /* @__PURE__ */ jsx("div", { children: links && links.map((link, idx) => {
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
/* @__PURE__ */ jsx("span", { className: styles.linkCell, onClick: link.onClick, children: /* @__PURE__ */ jsx("a", { href: link.href, target: link.target, children: link.title }) }, idx)
);
}) });
};
const getStyles = (theme) => ({
linkCell: css({
cursor: "pointer",
overflow: "hidden",
textOverflow: "ellipsis",
userSelect: "text",
whiteSpace: "nowrap",
color: theme.colors.text.link,
fontWeight: theme.typography.fontWeightMedium,
paddingRight: theme.spacing(1.5),
a: {
color: theme.colors.text.link
},
"&:hover": {
textDecoration: "underline",
color: theme.colors.text.link
}
})
});
export { DataLinksCell };
//# sourceMappingURL=DataLinksCell.mjs.map