WordPress / pattern-directory

The WordPress Block Pattern Directory
https://wordpress.org/patterns/
GNU General Public License v2.0
117 stars 30 forks source link

Use Gutenberg Site Editor component for pattern previews #380

Open shaunandrews opened 2 years ago

shaunandrews commented 2 years ago

The upcoming Site Editor includes a way to "focus" on a particular template part. It looks something like this:

https://user-images.githubusercontent.com/191598/142905771-0a0a3513-adff-4920-8966-26c429e8957a.mp4

It would be an improvement to make use of this component for previewing on the pattern detail pages (like https://wordpress.org/patterns/pattern/large-background-image-with-title-and-description/)

If we can't use the exact same component, perhaps we can update the styles of ours to look similar.

ryelle commented 2 years ago

This uses a resizableEditor component which is not exported, so we can't use it directly (we also don't need the "editor" functionality), but can probably take the gist of it from packages/edit-site/src/components/block-editor/resizable-editor.js.

StevenDufresne commented 2 years ago

It would be an improvement to make use of this component for previewing on the pattern detail pages

Can you go into detail as to why it would be an improvement to use the actual component?

ryelle commented 2 years ago

I don't think the component itself is the important part, it's matching the look of our preview to be similar. I imagine the reasoning is to keep the interaction patterns consistent between the Pattern Directory site and the editor.