Skip to content

Commit 123f45b

Browse files
committed
Rename CellButtons to CellActions
- to be more specific and intentional about what we're referring to
1 parent d794a70 commit 123f45b

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

src/components/datagrid/body/data_grid_cell.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ describe('EuiDataGridCell', () => {
6464
);
6565
component.setState({ enableInteractions: true });
6666

67-
const getCellButtons = () => component.find('EuiDataGridCellButtons');
68-
expect(getCellButtons()).toHaveLength(1);
67+
const getCellActions = () => component.find('EuiDataGridCellActions');
68+
expect(getCellActions()).toHaveLength(1);
6969

7070
// Should handle opening the popover
71-
(getCellButtons().prop('onExpandClick') as Function)();
71+
(getCellActions().prop('onExpandClick') as Function)();
7272
expect(mockPopoverContext.openCellPopover).toHaveBeenCalled();
7373

7474
// Should handle closing the popover
7575
component.setProps({
7676
isExpandable: true,
7777
popoverContext: { ...mockPopoverContext, popoverIsOpen: true },
7878
});
79-
(getCellButtons().prop('onExpandClick') as Function)();
79+
(getCellActions().prop('onExpandClick') as Function)();
8080
expect(mockPopoverContext.closeCellPopover).toHaveBeenCalledTimes(1);
81-
(getCellButtons().prop('closePopover') as Function)();
81+
(getCellActions().prop('closePopover') as Function)();
8282
expect(mockPopoverContext.closeCellPopover).toHaveBeenCalledTimes(2);
8383
});
8484

src/components/datagrid/body/data_grid_cell.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ import {
3333
EuiDataGridCellValueProps,
3434
} from '../data_grid_types';
3535
import {
36-
EuiDataGridCellButtons,
37-
EuiDataGridCellPopoverButtons,
38-
} from './data_grid_cell_buttons';
36+
EuiDataGridCellActions,
37+
EuiDataGridCellPopoverActions,
38+
} from './data_grid_cell_actions';
3939
import { IS_JEST_ENVIRONMENT } from '../../../test';
4040

4141
const EuiDataGridCellContent: FunctionComponent<
@@ -465,7 +465,7 @@ export class EuiDataGridCell extends Component<
465465
isDetails={true}
466466
/>
467467
</PopoverContent>
468-
<EuiDataGridCellPopoverButtons
468+
<EuiDataGridCellPopoverActions
469469
rowIndex={rowIndex}
470470
colIndex={colIndex}
471471
column={column}
@@ -495,8 +495,8 @@ export class EuiDataGridCell extends Component<
495495
const { rowIndex, visibleRowIndex, colIndex } = rest;
496496

497497
const popoverIsOpen = this.isPopoverOpen();
498-
const hasCellButtons = isExpandable || column?.cellActions;
499-
const showCellButtons =
498+
const hasCellActions = isExpandable || column?.cellActions;
499+
const showCellActions =
500500
this.state.isFocused ||
501501
this.state.isEntered ||
502502
this.state.enableInteractions ||
@@ -626,14 +626,14 @@ export class EuiDataGridCell extends Component<
626626
</EuiFocusTrap>
627627
);
628628

629-
if (hasCellButtons) {
630-
if (showCellButtons) {
629+
if (hasCellActions) {
630+
if (showCellActions) {
631631
innerContent = (
632632
<div className={anchorClass} ref={this.popoverAnchorRef}>
633633
<div className={expandClass}>
634634
<EuiDataGridCellContent {...cellContentProps} />
635635
</div>
636-
<EuiDataGridCellButtons
636+
<EuiDataGridCellActions
637637
rowIndex={rowIndex}
638638
colIndex={colIndex}
639639
column={column}

src/components/datagrid/body/data_grid_cell_buttons.test.tsx renamed to src/components/datagrid/body/data_grid_cell_actions.test.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import React from 'react';
1010
import { shallow } from 'enzyme';
1111

1212
import {
13-
EuiDataGridCellButtons,
14-
EuiDataGridCellPopoverButtons,
15-
} from './data_grid_cell_buttons';
13+
EuiDataGridCellActions,
14+
EuiDataGridCellPopoverActions,
15+
} from './data_grid_cell_actions';
1616

17-
describe('EuiDataGridCellButtons', () => {
17+
describe('EuiDataGridCellActions', () => {
1818
const requiredProps = {
1919
popoverIsOpen: false,
2020
closePopover: jest.fn(),
@@ -24,7 +24,7 @@ describe('EuiDataGridCellButtons', () => {
2424
};
2525

2626
it('renders an expand button', () => {
27-
const component = shallow(<EuiDataGridCellButtons {...requiredProps} />);
27+
const component = shallow(<EuiDataGridCellActions {...requiredProps} />);
2828

2929
expect(component).toMatchInlineSnapshot(`
3030
<div
@@ -33,7 +33,7 @@ describe('EuiDataGridCellButtons', () => {
3333
<EuiI18n
3434
default="Click or hit enter to interact with cell content"
3535
key="expand"
36-
token="euiDataGridCellButtons.expandButtonTitle"
36+
token="euiDataGridCellActions.expandButtonTitle"
3737
>
3838
<Component />
3939
</EuiI18n>
@@ -57,7 +57,7 @@ describe('EuiDataGridCellButtons', () => {
5757

5858
it('renders column cell actions as `EuiButtonIcon`s', () => {
5959
const component = shallow(
60-
<EuiDataGridCellButtons
60+
<EuiDataGridCellActions
6161
{...requiredProps}
6262
column={{ id: 'someId', cellActions: [() => <button />] }}
6363
/>
@@ -79,7 +79,7 @@ describe('EuiDataGridCellButtons', () => {
7979
<EuiI18n
8080
default="Click or hit enter to interact with cell content"
8181
key="expand"
82-
token="euiDataGridCellButtons.expandButtonTitle"
82+
token="euiDataGridCellActions.expandButtonTitle"
8383
>
8484
<Component />
8585
</EuiI18n>
@@ -98,10 +98,10 @@ describe('EuiDataGridCellButtons', () => {
9898
});
9999
});
100100

101-
describe('EuiDataGridCellPopoverButtons', () => {
101+
describe('EuiDataGridCellPopoverActions', () => {
102102
it('renders column cell actions as `EuiButtonEmpty`s', () => {
103103
const component = shallow(
104-
<EuiDataGridCellPopoverButtons
104+
<EuiDataGridCellPopoverActions
105105
colIndex={0}
106106
rowIndex={0}
107107
column={{ id: 'someId', cellActions: [() => <button />] }}
@@ -143,7 +143,7 @@ describe('EuiDataGridCellPopoverButtons', () => {
143143

144144
it('does not render anything if the column has no cell actions', () => {
145145
const component = shallow(
146-
<EuiDataGridCellPopoverButtons
146+
<EuiDataGridCellPopoverActions
147147
colIndex={0}
148148
rowIndex={0}
149149
column={{ id: 'noActions' }}

src/components/datagrid/body/data_grid_cell_buttons.tsx renamed to src/components/datagrid/body/data_grid_cell_actions.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { EuiButtonEmpty, EuiButtonEmptyProps } from '../../button/button_empty';
2020
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
2121
import { EuiPopoverFooter } from '../../popover';
2222

23-
export const EuiDataGridCellButtons = ({
23+
export const EuiDataGridCellActions = ({
2424
popoverIsOpen,
2525
closePopover,
2626
onExpandClick,
@@ -44,7 +44,7 @@ export const EuiDataGridCellButtons = ({
4444
const expandButton = (
4545
<EuiI18n
4646
key={'expand'}
47-
token="euiDataGridCellButtons.expandButtonTitle"
47+
token="euiDataGridCellActions.expandButtonTitle"
4848
default="Click or hit enter to interact with cell content"
4949
>
5050
{(expandButtonTitle: string) => (
@@ -74,11 +74,11 @@ export const EuiDataGridCellButtons = ({
7474
? column.cellActions.map(
7575
(Action: EuiDataGridColumnCellAction, idx: number) => {
7676
// React is more permissible than the TS types indicate
77-
const CellButtonElement = Action as JSXElementConstructor<
77+
const ActionButtonElement = Action as JSXElementConstructor<
7878
EuiDataGridColumnCellActionProps
7979
>;
8080
return (
81-
<CellButtonElement
81+
<ActionButtonElement
8282
key={idx}
8383
rowIndex={rowIndex}
8484
colIndex={colIndex}
@@ -98,7 +98,7 @@ export const EuiDataGridCellButtons = ({
9898
);
9999
};
100100

101-
export const EuiDataGridCellPopoverButtons = ({
101+
export const EuiDataGridCellPopoverActions = ({
102102
rowIndex,
103103
colIndex,
104104
column,
@@ -114,12 +114,12 @@ export const EuiDataGridCellPopoverButtons = ({
114114
<EuiFlexGroup gutterSize="s">
115115
{column.cellActions.map(
116116
(Action: EuiDataGridColumnCellAction, idx: number) => {
117-
const CellButtonElement = Action as JSXElementConstructor<
117+
const ActionButtonElement = Action as JSXElementConstructor<
118118
EuiDataGridColumnCellActionProps
119119
>;
120120
return (
121121
<EuiFlexItem key={idx}>
122-
<CellButtonElement
122+
<ActionButtonElement
123123
rowIndex={rowIndex}
124124
colIndex={colIndex}
125125
columnId={column.id}

0 commit comments

Comments
 (0)