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

Data views: Unbox items in grid layout #61159

Merged
merged 2 commits into from
Apr 29, 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
39 changes: 23 additions & 16 deletions packages/dataviews/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -292,41 +292,54 @@
}

.dataviews-view-grid__card {
border-radius: $radius-block-ui * 2;
border: 1px solid $gray-200;
height: 100%;
justify-content: flex-start;

.dataviews-view-grid__title-actions {
padding: $grid-unit-05 $grid-unit $grid-unit-05 $grid-unit-05;
padding: $grid-unit-10 0 $grid-unit-05;
}

.dataviews-view-grid__primary-field {
min-height: $grid-unit-50;
min-height: $grid-unit-40; // Preserve layout when there is no ellipsis button
}
&.is-selected {
border-color: var(--wp-admin-theme-color);
background-color: rgba(var(--wp-admin-theme-color--rgb), 0.04);

&.is-selected {
.dataviews-view-grid__fields .dataviews-view-grid__field .dataviews-view-grid__field-value {
color: $gray-900;
}

.page-pages-preview-field__button::after {
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
}
}
}

.dataviews-view-grid__media {
width: 100%;
min-height: 200px;
aspect-ratio: 1/1;
border-bottom: 1px solid $gray-200;
background-color: $gray-100;
border-radius: 3px 3px 0 0;
border-radius: $grid-unit-05;
overflow: hidden;
position: relative;

img {
object-fit: cover;
width: 100%;
height: 100%;
}

&::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.1);
border-radius: $grid-unit-05;
}
Comment on lines +333 to +342
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps due to this pseudo-element, the clickable area in the pattern preview is limited to the actual content.

Can one of the following approaches solve the problem?

  • .dataviews-view-grid .dataviews-view-grid__media:after: Add pointer-envents: none
  • .page-patterns-preview-field__button: Add z-index: 1
ed9c39e3a07caa35f39a02c25fe69a44.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, and suggestion. I'll work on a follow-up.

}

.dataviews-view-grid__fields {
Expand All @@ -337,7 +350,6 @@
&:not(:empty) {
padding: $grid-unit-15 0;
padding-top: 0;
margin: 0 $grid-unit-15;
}

.dataviews-view-grid__field {
Expand Down Expand Up @@ -366,8 +378,7 @@

.dataviews-view-grid__badge-fields {
&:not(:empty) {
padding: $grid-unit-15;
padding-top: 0;
padding-bottom: $grid-unit-15;
}

.dataviews-view-grid__field-value {
Expand Down Expand Up @@ -555,10 +566,6 @@
flex-shrink: 0;
}

.dataviews-view-grid__title-actions .dataviews-view-table-selection-checkbox {
margin-left: $grid-unit-10;
}

.dataviews-filter-summary__popover {
.components-popover__content {
width: 230px;
Expand Down
11 changes: 11 additions & 0 deletions packages/edit-site/src/components/page-pages/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,15 @@
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
}

// Make the button targetable for clicks
&::after {
content: "";
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 1;
}
}
Loading