Skip to content

Commit

Permalink
DataViews: Reduce the size of action button in Grid layout (WordPress…
Browse files Browse the repository at this point in the history
…#67032)

Co-authored-by: t-hamano <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent 68d7776 commit 6b42879
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions packages/dataviews/src/components/dataviews-item-actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ interface ItemActionsProps< Item > {
interface CompactItemActionsProps< Item > {
item: Item;
actions: Action< Item >[];
isSmall?: boolean;
}

interface PrimaryActionsProps< Item > {
Expand Down Expand Up @@ -214,7 +215,13 @@ export default function ItemActions< Item >( {
}, [ actions, item ] );

if ( isCompact ) {
return <CompactItemActions item={ item } actions={ eligibleActions } />;
return (
<CompactItemActions
item={ item }
actions={ eligibleActions }
isSmall
/>
);
}

if ( hasOnlyOneActionAndIsPrimary( primaryActions, actions ) ) {
Expand Down Expand Up @@ -250,12 +257,13 @@ export default function ItemActions< Item >( {
function CompactItemActions< Item >( {
item,
actions,
isSmall,
}: CompactItemActionsProps< Item > ) {
return (
<Menu
trigger={
<Button
size="compact"
size={ isSmall ? 'small' : 'compact' }
icon={ moreVertical }
label={ __( 'Actions' ) }
accessibleWhenDisabled
Expand Down
2 changes: 1 addition & 1 deletion packages/dataviews/src/dataviews-layouts/grid/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}

.dataviews-view-grid__primary-field {
min-height: $grid-unit-40; // Preserve layout when there is no ellipsis button
min-height: $grid-unit-30; // Preserve layout when there is no ellipsis button
display: flex;
align-items: center;

Expand Down

0 comments on commit 6b42879

Please sign in to comment.