Skip to content

Commit

Permalink
Update: De-emphasise bulk actions on Grid layout. (#64209)
Browse files Browse the repository at this point in the history
Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
  • Loading branch information
7 people authored Aug 5, 2024
1 parent ac9a418 commit 645ae89
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
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;

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;
}

0 comments on commit 645ae89

Please sign in to comment.