Problem/Motivation
As discussed in #3336654: [2.0.x] Update ui_patterns_library and rethink patterns previews we'd like to allow themers to define as many previews as they like for their patterns.
Proposed resolution
- Declare previews in a separate section of the pattern.yml file OR even in a separate file.
- Each preview has a machine name
- Each preview can have a label (fallback to machine name either way)
- Each preview can define the variant it uses (if empty, loop on each variants)
- Each preview can set slots and props (if empty, let it be)
Issue fork ui_patterns-3360373
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pdureau commentedDone according to the specifications: https://docs.google.com/document/d/1-GaMK1Qk-h0hmB7GtAcnqPTuCOGMaxeRguop...
The separate section in the file is called "stories".
I am not sure the fallback to machine name was implemented.
Not implemented yet.
Comment #3
pdureau commentedComment #4
pdureau commentedComment #5
pdureau commentedComment #6
sharique commentedFor creating multiple previews of pattern, I think best approach is to create examples page using https://www.drupal.org/project/ui_examples or create story using storybooks.
Comment #7
pdureau commentedComment #8
grimreaperHi,
Not sure if this is the correct issue to post that.
I think it would be nice to have a mechanism which allows a module or theme to add stories to an existing component without having to redeclare the component.
Comment #9
pdureau commentedComment #10
pdureau commentedTODO, but wr may need the plugin manage expected for #3414774: JSON schema examples property
already done.
Moved to dedicated issue: #3455354: [2.0.0-beta4] Add a stories specific discovery
Comment #11
pdureau commentedMoved to beta1 because of all the current work on #3438360: Use Drupal entities & plugins for the Library pages which is totally reorganizing the codebase.
Once #3438360: Use Drupal entities & plugins for the Library pages is done, let's recheck everything expected by this ticket.
Comment #12
pdureau commentedComment #13
greenskin commentedIt would be fantastic to work with UI Patterns Settings so settings can be exposed on previews and users can preview them in real-time.
Comment #14
g4mbini+1 regarding #13 , like in Storybook @pdureau 😅
Comment #15
pdureau commentedWe already have a ticket for that: #3347990: [2.2.0] UI Patterns Library: add some interactions
Comment #16
pdureau commentedComment #17
pdureau commentedComment #18
pdureau commentedComment #19
pdureau commentedFollowing #3444822: [2.0.0-alpha3] Add allow_variant_expose source plugin, "variant" is now visible in the prop list. Remove it.
Comment #20
pdureau commented"variant" removed in an other ticket
Comment #21
pdureau commented