Skip to content

Commit

Permalink
DataViews: Reduce the size of action button in Grid layout (#67032)
Browse files Browse the repository at this point in the history
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

1 comment on commit 6b42879

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 6b42879.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11913099821
📝 Reported issues:

Please sign in to comment.