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

Enable template part specific block patterns. #28802

Closed
Addison-Stavlo opened this issue Feb 5, 2021 · 6 comments
Closed

Enable template part specific block patterns. #28802

Addison-Stavlo opened this issue Feb 5, 2021 · 6 comments
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced

Comments

@Addison-Stavlo
Copy link
Contributor

What problem does this address?

As noted in #27337 - we should enable special block patterns that only show up when specific template part types are selected (such as header or footer).

Also related to - #27575

What is your proposed solution?

Once #28410 lands, we should have a way to distinguish what section type a template part corresponds to. This should open up the ability to link block patterns to them.

@Addison-Stavlo Addison-Stavlo added [Feature] Full Site Editing [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Feb 5, 2021
@david-szabo97
Copy link
Member

I wonder what would be the best way to tackle this implementation-wise. Should we add a filter and use that to manipulate the patterns array in the usePatternsState hook?

patterns: __experimentalGetAllowedPatterns( rootClientId ),

What should happen to template part-specific block patterns? Should they appear on top of the list? Or a bit separated from the others? 🤔 @jameskoster What do you think? Do we have a mock-up for this?

@jameskoster
Copy link
Contributor

What do you think? Do we have a mock-up for this?

There are some ideas over in #28737 for on-canvas pattern suggestions. Inserter changes will be explored in #28739.

@Addison-Stavlo
Copy link
Contributor Author

I think a good first step for this would be to find a way to enable this 'recommendation' in the existing UI. That is, when we are selected inside a template part the normal sidebar patterns inserter should show patterns corresponding to template parts of that 'area' as the first results. This will allow us to have a better technical understanding of what we need in place and how to best enable this recommendation feature (what filters, hooks, data structures, etc. make the most sense to enable this).

That exploration should make creating 'new UI' areas specifically for recommendations easier to implement once those designs are more finalized and ready to be created.

@Addison-Stavlo
Copy link
Contributor Author

What should happen to template part-specific block patterns? Should they appear on top of the list? Or a bit separated from the others?

I wonder if we could conditionally add an item to this dropdown in that case. If a header is selected (and header patterns exist), have a 'header' option in this dropdown and have the patterns inserter default to that when it opens:

Screen Shot 2021-02-22 at 4 15 02 PM

@Addison-Stavlo
Copy link
Contributor Author

I wonder if we could conditionally add an item to this dropdown in that case.

We hacked up a quick PR to see what that would feel like - #29595 just to test. But the current inserting behavior of appending beneath the currently selected block makes it feel quite clunky though. 🤔

@priethor priethor mentioned this issue Apr 23, 2021
22 tasks
@Addison-Stavlo
Copy link
Contributor Author

Closing this as we have used the blockTypes array in pattern registration to link template part variations to patterns. #31155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced
Projects
None yet
Development

No branches or pull requests

3 participants