django-pattern-library icon indicating copy to clipboard operation
django-pattern-library copied to clipboard

Add support for pattern variants

Open thibaudcolas opened this issue 4 years ago • 4 comments

Extracted from #28.

Add pattern variants (nice to have - not essential for open sourcing)

thibaudcolas avatar Feb 24 '20 20:02 thibaudcolas

Will also add some notes from @nmorduch in #11 about this, which seems related:

An established setup for situations where our pattern templates don't show everything

  • overviews (e.g. here are all the types of buttons)
  • mockups (e.g. here is just a plain page with a functional modal, but it's not what you would use to include the modal)
  • what something looks like with every permutation of fake data

this could possibly be accomplished with some combination of:

  • a folder for overviews and mockups (or one for each)
  • a setup where you write in the yaml that there are multiple versions of the data, and then when viewing the pattern library you get an overview page or you get the pattern but with the option to select which data set you want. e.g.:
contexts:
  display: switcher
  - name: No introduction
    context:
      page:
        title: Page Title
  - name: Short intro
    context:
      page:
        title: Page Title
        introduction: Introduction to page
  - name: Long intro
    context:
      page:
        title: Page Title
        introduction: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque laoreet ante ac sapien eleifend tincidunt id ac diam. 
contexts:
  display: overview
  - name: .button
    template: button.html
    context:
      label: Default button
  - name: .button--alt
    template: button.html
    context:
      label: Alt button
      classes: button--alt
  - name: .button--large
    template: button-large.html
    context:
      label: Large button
```	

thibaudcolas avatar Feb 28 '20 09:02 thibaudcolas

Mentioned in the docs as of #131, with workaround.

thibaudcolas avatar Oct 30 '20 08:10 thibaudcolas

@thibaudcolas wrote

Mentioned in the docs as of https://github.com/torchbox/django-pattern-library/pull/131, with workaround.

Sorry, but what workaround is this? I went to #131 but I am none the wiser.

simkimsia avatar Jul 23 '22 07:07 simkimsia

@simkimsia here are the docs that cover this: https://torchbox.github.io/django-pattern-library/guides/multiple-variants/

thibaudcolas avatar Aug 03 '22 16:08 thibaudcolas