-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Fix table view cell wrapper and BlockPreviews #58062
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jameskoster I gave it a try to be able to render block previews with this, but I'm not 100% sure if it's the right solution.
In general the previews issue stems from useResizeObserver, where it seems it can determine a width if we have just the
display:flex
. I'm not sure if @ciampo has any thoughts on this about whether it's something that should be handled by the hook.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Nik. Visually this looks a lot better. Subject to Marco's feedback we can probably add a fixed height to the previews in table layout so they are consistent. It would also be nice to apply the theme background color to the container to avoid these awkward gray spaces in grid layout:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already looks like we crop template previews to a max-height in the table view, so we could easily lower that number — although that means that if a template preview image is shorter than that image, that row will take less space.
If instead we want to enforce a fixed height, we could adopt the same technique employed for the Grid layout (basically the
object-fit: cover
behavior).In any case, this could be discussed / applied in a separate PR, since the goal of this PR is to fix the markup and make sure that the preview image appears correctly.
I hacked around and managed to achieve that with this code
Although we should probably expose an API and apply a background color only when we are certain that the media that we are previewing would actually match that background color (like when managing templates).
This is also something that we should probably experiment with in a separate PR.
Finally, I wanted to flag that, when I pick the Grid layout and reload the page, the template preview images didn't load. In order to have them load correctly, I had to switch to the Table layout, and enable the preview field.