Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataViews: Reduce the size of action button in Grid layout #67032

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading