The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/packages/grafana-ui/src/components/InteractiveTable/ExpanderCell.tsx

29 lines
931 B

import { css } from '@emotion/css';
import React from 'react';
import { CellProps } from 'react-table';
import { IconButton } from '../IconButton/IconButton';
const expanderContainerStyles = css`
display: flex;
align-items: center;
height: 100%;
`;
export function ExpanderCell<K extends object>({ row, __rowID }: CellProps<K, void> & { __rowID: string }) {
return (
<div className={expanderContainerStyles}>
<IconButton
tooltip="toggle row expanded"
aria-controls={__rowID}
// @ts-expect-error react-table doesn't ship with useExpanded types and we can't use declaration merging without affecting the table viz
name={row.isExpanded ? 'angle-down' : 'angle-right'}
// @ts-expect-error same as the line above
aria-expanded={row.isExpanded}
// @ts-expect-error same as the line above
{...row.getToggleRowExpandedProps()}
/>
</div>
);
}