Skip to content

Commit 5a9d10d

Browse files
committed
Fix actions on indexes table
1 parent e4e7060 commit 5a9d10d

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

packages/compass-indexes/src/components/indexes-table/indexes-table.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,13 @@ const rowStyles = css({
5454

5555
// When row is not hovered, we hide the delete button
5656
const indexActionsCellStyles = css({
57-
display: 'flex',
58-
justifyContent: 'flex-end',
5957
button: {
6058
opacity: 0,
6159
'&:focus': {
6260
opacity: 1,
6361
},
6462
},
65-
minWidth: spacing[5],
63+
minWidth: spacing[800],
6664
});
6765

6866
const tableHeadStyles = css({
@@ -159,16 +157,16 @@ export function IndexesTable<T>({
159157
}`}
160158
>
161159
{row.getVisibleCells().map((cell: LeafyGreenTableCell<T>) => {
160+
const isActionsCell = cell.column.id === 'actions';
162161
return (
163162
<Cell
164163
key={cell.id}
165164
id={cell.id}
166165
cell={cell}
167-
className={cx(
168-
cell.column.id === 'actions' && indexActionsCellStyles,
169-
cell.column.id === 'actions' &&
170-
indexActionsCellClassName
171-
)}
166+
className={cx({
167+
[indexActionsCellClassName]: isActionsCell,
168+
[indexActionsCellStyles]: isActionsCell,
169+
})}
172170
data-testid={`${dataTestId}-${cell.column.id}-field`}
173171
>
174172
{flexRender(

packages/compass-indexes/src/components/regular-indexes-table/regular-index-actions.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import semver from 'semver';
22
import React, { useCallback, useMemo } from 'react';
33
import type { GroupedItemAction } from '@mongodb-js/compass-components';
4-
import { ItemActionGroup } from '@mongodb-js/compass-components';
4+
import { css, ItemActionGroup } from '@mongodb-js/compass-components';
5+
6+
const styles = css({
7+
// Align actions with the end of the table
8+
justifyContent: 'flex-end',
9+
});
510

611
type Index = {
712
name: string;
@@ -83,9 +88,10 @@ const IndexActions: React.FunctionComponent<IndexActionsProps> = ({
8388
return (
8489
<ItemActionGroup<IndexAction>
8590
data-testid="index-actions"
91+
className={styles}
8692
actions={indexActions}
8793
onAction={onAction}
88-
></ItemActionGroup>
94+
/>
8995
);
9096
};
9197

0 commit comments

Comments
 (0)