django-pattern-library
django-pattern-library copied to clipboard
Add support for pattern variants
Extracted from #28.
Add pattern variants (nice to have - not essential for open sourcing)
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
```
Mentioned in the docs as of #131, with workaround.
@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 here are the docs that cover this: https://torchbox.github.io/django-pattern-library/guides/multiple-variants/