import { css, cx } from '@emotion/css'; import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; import { DynamicTable, DynamicTableProps } from './DynamicTable'; export type DynamicTableWithGuidelinesProps = Omit, 'renderPrefixHeader, renderPrefixCell'>; // DynamicTable, but renders visual guidelines on the left, for larger screen widths export const DynamicTableWithGuidelines = ({ renderExpandedContent, ...props }: DynamicTableWithGuidelinesProps) => { const styles = useStyles2(getStyles); return ( ( <> {!(index === items.length - 1) &&
} {renderExpandedContent(item, index, items)} ) : undefined } renderPrefixHeader={() => (
)} renderPrefixCell={(_, index, items) => (
{!(index === items.length - 1) &&
}
)} {...props} /> ); }; export const getStyles = (theme: GrafanaTheme2) => ({ relative: css` position: relative; height: 100%; `, guideline: css` left: -19px; border-left: 1px solid ${theme.colors.border.medium}; position: absolute; ${theme.breakpoints.down('md')} { display: none; } `, topGuideline: css` width: 18px; border-bottom: 1px solid ${theme.colors.border.medium}; top: 0; bottom: 50%; `, bottomGuideline: css` top: 50%; bottom: 0; `, contentGuideline: css` top: 0; bottom: 0; left: -49px !important; `, headerGuideline: css` top: -25px; bottom: 0; `, });