From c0688060f1cf8d53bafa0a720a591bd34aa6b156 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Sat, 4 Nov 2023 22:27:38 -0700 Subject: [PATCH] [cleanup] Remove more now-unnecessary height-based CSS/logic --- src/components/datagrid/body/data_grid_cell.tsx | 9 +++------ .../datagrid/body/data_grid_cell_actions.test.tsx | 12 ------------ .../datagrid/body/data_grid_cell_actions.tsx | 13 +++++-------- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/components/datagrid/body/data_grid_cell.tsx b/src/components/datagrid/body/data_grid_cell.tsx index 4c2214dd26ee..c064f1a73f04 100644 --- a/src/components/datagrid/body/data_grid_cell.tsx +++ b/src/components/datagrid/body/data_grid_cell.tsx @@ -54,7 +54,6 @@ const EuiDataGridCellContent: FunctionComponent< isFocused: boolean; ariaRowIndex: number; rowHeight?: EuiDataGridRowHeightOption; - cellHeightType: string; cellActions?: ReactNode; } > = memo( @@ -69,7 +68,6 @@ const EuiDataGridCellContent: FunctionComponent< rowHeightUtils, isControlColumn, isFocused, - cellHeightType, cellActions, ...rest }) => { @@ -77,6 +75,9 @@ const EuiDataGridCellContent: FunctionComponent< const CellElement = renderCellValue as JSXElementConstructor; + const cellHeightType = + rowHeightUtils?.getHeightType(rowHeight) || 'default'; + const classes = classNames( 'euiDataGridRowCell__content', `euiDataGridRowCell__content--${cellHeightType}Height`, @@ -711,15 +712,12 @@ export class EuiDataGridCell extends Component< rowIndex, rowHeightsOptions ); - const cellHeightType = - rowHeightUtils?.getHeightType(rowHeight) || 'default'; const cellContentProps = { ...rest, setCellProps: this.setCellProps, column, columnType, - cellHeightType, isExpandable, isExpanded: popoverIsOpen, isDetails: false, @@ -739,7 +737,6 @@ export class EuiDataGridCell extends Component< rowIndex={rowIndex} colIndex={colIndex} column={column} - cellHeightType={cellHeightType} onExpandClick={() => { if (popoverIsOpen) { closeCellPopover(); diff --git a/src/components/datagrid/body/data_grid_cell_actions.test.tsx b/src/components/datagrid/body/data_grid_cell_actions.test.tsx index 91e99018727e..4079923ffea4 100644 --- a/src/components/datagrid/body/data_grid_cell_actions.test.tsx +++ b/src/components/datagrid/body/data_grid_cell_actions.test.tsx @@ -8,7 +8,6 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { render } from '../../../test/rtl'; import { EuiDataGridColumnCellAction } from '../data_grid_types'; import { @@ -113,17 +112,6 @@ describe('EuiDataGridCellActions', () => { `); }); - it('renders with overlay positioning for non default height cells', () => { - const { container } = render( - - ); - - // TODO: Switch to `.toHaveStyle({ position: 'absolute' })` once on Emotion - expect(container.firstChild).toHaveClass( - 'euiDataGridRowCell__actions--overlay' - ); - }); - describe('visible cell actions limit', () => { it('by default, does not render more than the first two primary cell actions', () => { const component = shallow( diff --git a/src/components/datagrid/body/data_grid_cell_actions.tsx b/src/components/datagrid/body/data_grid_cell_actions.tsx index e95332e2a8fc..451ebe87c14d 100644 --- a/src/components/datagrid/body/data_grid_cell_actions.tsx +++ b/src/components/datagrid/body/data_grid_cell_actions.tsx @@ -18,20 +18,17 @@ import { EuiButtonIcon, EuiButtonIconProps } from '../../button/button_icon'; import { EuiButtonEmpty, EuiButtonEmptyProps } from '../../button/button_empty'; import { EuiFlexGroup, EuiFlexItem } from '../../flex'; import { EuiPopoverFooter } from '../../popover'; -import classNames from 'classnames'; export const EuiDataGridCellActions = ({ onExpandClick, column, rowIndex, colIndex, - cellHeightType, }: { onExpandClick: () => void; column?: EuiDataGridColumn; rowIndex: number; colIndex: number; - cellHeightType: string; }) => { // Note: The cell expand button/expansion popover is *always* rendered if // column.cellActions is present (regardless of column.isExpandable). @@ -96,11 +93,11 @@ export const EuiDataGridCellActions = ({ ); }, [column, colIndex, rowIndex]); - const classes = classNames('euiDataGridRowCell__actions', { - 'euiDataGridRowCell__actions--overlay': cellHeightType !== 'default', - }); - - return
{[...additionalButtons, expandButton]}
; + return ( +
+ {[...additionalButtons, expandButton]} +
+ ); }; export const EuiDataGridCellPopoverActions = ({