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

Update: De-emphasise bulk actions on Grid layout. #64209

Merged
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
3 changes: 3 additions & 0 deletions packages/base-styles/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ $z-layers: (
// Ensure checkbox + actions don't overlap table header
".dataviews-view-table thead": 1,

// Ensure selection checkbox stays above the preview field.
".dataviews-view-grid__card .dataviews-selection-checkbox": 1,

// Ensure quick actions toolbar appear above pagination
".dataviews-bulk-actions-toolbar": 2,
);
Expand Down
16 changes: 8 additions & 8 deletions packages/dataviews/src/layouts/grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ function GridItem< Item >( {
<div className="dataviews-view-grid__media">
{ renderedMediaField }
</div>
<SingleSelectionCheckbox
item={ item }
selection={ selection }
onChangeSelection={ onChangeSelection }
getItemId={ getItemId }
primaryField={ primaryField }
disabled={ ! hasBulkAction }
/>
<HStack
justify="space-between"
className="dataviews-view-grid__title-actions"
>
<SingleSelectionCheckbox
item={ item }
selection={ selection }
onChangeSelection={ onChangeSelection }
getItemId={ getItemId }
primaryField={ primaryField }
disabled={ ! hasBulkAction }
/>
<HStack className="dataviews-view-grid__primary-field">
{ renderedPrimaryField }
</HStack>
Expand Down
20 changes: 20 additions & 0 deletions packages/dataviews/src/layouts/grid/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.dataviews-view-grid__card {
height: 100%;
justify-content: flex-start;
position: relative;

.dataviews-view-grid__title-actions {
padding: $grid-unit-10 0 $grid-unit-05;
Expand All @@ -22,6 +23,11 @@
.dataviews-view-grid__fields .dataviews-view-grid__field .dataviews-view-grid__field-value {
color: $gray-900;
}

.dataviews-view-grid__media::after {
background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
box-shadow: inset 0 0 0 $border-width var(--wp-admin-theme-color);
}
}
}

Expand All @@ -32,6 +38,7 @@
background-color: $gray-100;
border-radius: $grid-unit-05;
position: relative;
overflow: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fixes a bug where template and pattern previews were bleeding outside the container.


img {
object-fit: cover;
Expand Down Expand Up @@ -148,3 +155,16 @@
.dataviews-view-grid__field:empty {
display: none;
}

.dataviews-view-grid__card .dataviews-selection-checkbox {
position: absolute;
top: -9999em;
left: $grid-unit-10;
z-index: z-index(".dataviews-view-grid__card .dataviews-selection-checkbox");
}

.dataviews-view-grid__card:hover .dataviews-selection-checkbox,
.dataviews-view-grid__card:focus-within .dataviews-selection-checkbox,
.dataviews-view-grid__card.is-selected .dataviews-selection-checkbox {
top: $grid-unit-10;
}
Loading