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

Library: enable ability to create & classify a pattern library alongside reusable blocks #50028

Closed
Tracked by #33094
annezazu opened this issue Apr 24, 2023 · 6 comments · Fixed by #51078
Closed
Tracked by #33094
Assignees
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Needs Design Needs design efforts.

Comments

@annezazu
Copy link
Contributor

Pulling this out of phase 2 tasks #33094 to include a standalone issue. I welcome edits! This work ties into longer term work around phase 3:

Library. Introduce an admin section or “library” for managing blocks, patterns, styles, and fonts. As part of this work, also look at what improvements can be done to enhance the media library design, interactions, and extensibility.

For now, the focus is on implementing this for patterns alongside reusable blocks. Currently, there's a work in progress PR to explore what this might look like to create and save patterns: #49607

Of note, we should keep in mind the work being done with the wp:pattern block namely due to this item:

Possibly unifying concepts with reusable blocks where everything is a "pattern" just with different sync properties.

@annezazu annezazu added Needs Design Needs design efforts. [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Apr 24, 2023
@annezazu annezazu mentioned this issue Apr 24, 2023
57 tasks
@SaxonF SaxonF mentioned this issue May 10, 2023
6 tasks
@SaxonF
Copy link
Contributor

SaxonF commented May 17, 2023

Attaching a scoped design here based off the sync video shared in the main patterns thread #48458. Note that this is essentially Milestone 1 of the work detailed here.

manage-patterns.mp4

This piece of work is purely relating to the management side of patterns which we will need regardless of direction. This does not include syncing behaviour.

  • Library contains template parts and patterns, with an external link out to re-usable blocks (for now)
  • Template parts are separated from the rest, positioned at the top
  • Pattern categories are listed below
  • Clicking a category shows patterns on right in a masonry style
  • Clicking a pattern on the right opens it in editor
  • Any block can be turned into a pattern via the more menu item "Create a pattern"
  • Template part categories behave the same way
  • Each pattern in the grid has a more menu that initially just contains a delete action

TODO Design:

  • Separate action to trigger drill down for template part
  • Pattern renaming and editing category
  • Category creation if none exists

@jasmussen
Copy link
Contributor

Nice work Saxon, this feels close to ready. A few comments and questions, first one coming to mind is, should the Library also hold Reusable Blocks? And if yes, should we separate patterns and RBs with a subheading, but otherwise show them in one list? Or should we add drilldowns for each? Speaking of this screen:

Screenshot 2023-05-17 at 08 36 10

Whether drilldown or not, it might also be useful to have a new variation of the reusable blocks icon that denotes "Patterns". I imagine still the double rhomboids but perhaps with flair in the pattern version. Such an icon would be useful not just for a drilldown menu, or perhaps a subheading, but also to show here:

Screenshot 2023-05-17 at 08 35 01

I'm happy to work on one.

This purple snackbar I recall from #49980
Screenshot 2023-05-17 at 08 35 46

This is to denote the global/synced nature of patterns, correct? Can work, but probably not a blocker for dev work to move forward with a default snackbar in the interim.

@adriacobo
Copy link
Contributor

Hi! It's so lovely this navigation! Nice job!
Will the Library page be merged with classic themes?
It is an exciting way to navigate the patterns and reusable blocks.
Thank you!

@glendaviesnz
Copy link
Contributor

glendaviesnz commented May 31, 2023

@SaxonF, @jasmussen how do you imagine the difference between local and remote patterns working in the Library? In theory, Patterns will be able to be pulled in from 3 different places with these changes:

  • Remote .org patterns via API
  • Theme patterns via files in the theme directory
  • User-created patterns from a CPT

In terms of adding/editing/deleting it is straightforward for the user-created patterns in the CPT. In terms of the remote and theme patterns editing is straightforward, ie. when choosing to edit the pattern the content can be copied to a CPT at that point. But, with delete of remote/theme patterns, are you imagining that users will be able to curate which of these will be available to users via the Library? In which case we may have to save some sort of pattern slug disallow list filter which is used by the pattern inserter to remove this from display.

Hopefully all that makes sense, get back to me if not.

@SaxonF
Copy link
Contributor

SaxonF commented May 31, 2023

@glendaviesnz I think to start with we should follow existing template/template part behaviour for the most part.

  • You can add/edit/delete patterns that are user created
  • You can't delete theme patterns but you can modify them.
  • You should be able to add remote patterns to your local library, at which point they are now user created. You're essentially remixing them. I don't think we should display remote patterns directly in the library but we should have links out to the directory. "e.g. View hero patterns created by the community". This piece of work needs more design consideration though and shouldn't block a first release of library.

In future we can look at adding the ability to delete/archive theme patterns which as you mentioned would be more like a flag on the pattern vs actually removing the pattern.

@gziolo
Copy link
Member

gziolo commented May 31, 2023

There are also patterns that sites or plugins can create by using register_block_pattern function directly. The same function gets called internally to register any patterns that the active theme may provide under its ./patterns/ directory.

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 [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Needs Design Needs design efforts.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

8 participants