Closed anderspollack closed 11 months ago
Anders, your efforts sticking with the challenges of using WebC are producing some good patterns and this implementation is coming together. Writing the data as JSON to a script tag is likely a useful pattern for other client side data interaction.
Anders, packages/11ty/_includes/components/catalog-content.webc
could be moved into either layouts/objects-catalog.webc
or components/objects-catalog.webc
Object filters
This branch includes work in progress on the Quire Object Filters feature. This adds new
webc
components, and awebc
layout topackages/11ty
.See demo Netlify publication: https://quire-object-filters-demo.netlify.app/catalogue/alt/
New Components
This PR adds the following new webc components:
_layouts/objects-catalog.webc
_includes/components/objects-catalog.webc
_includes/components/objects-data.webc
_includes/components/object-cards.webc
_includes/components/object-card.webc
_includes/components/object-filters.webc
Instructions
Add another page to a catalogue directory:
To Do
object_card
field inobjects.yaml
:layouts/object-catalog
content
filters
parameter value does not match any object properties an error should be displayed in the console.media type: image
for an objectfigure
has choice layers, (nosrc
), use the base layerthumbnail
to the figureadapter()
payload to provide a URL for the thumbnail imagebase.11ty.js
support WebC bundles https://www.11ty.dev/docs/languages/webc/#css-and-js-(bundler-mode) (getBundle('css')
andgetBundle('js')
) -- adding bundled styles to_layouts/objects-catalog.webc
for nowwebc:scoped
styles (can we pass typography and color tokens through to scoped styles?)Questions
classes
need to be set in the content file front matter? (errors if not set)This is the objects catalogue
We have access to property data (like
gradoo
) inside a<script webc:type="js">
block. Note: withwebc:type="js"
, the final line gets rendered to the DOM.my-component.webc
Properties can also be passed and accessed in markup
Data handling
When we need to pass server-side data (11ty context) to the client, we do so by embedding it as JSON in a
<script type="application/json">
tag:component-data.webc
Then we can have access to it via
querySelector
:my-component.webc
Responsive prototype for object filters UI on Quire catalog pages. To test, create a new publication with your local quire-11ty package: ``` quire new object-filters-demo --quire-path ~/full/path/to/local/quire/packages/11ty/ ``` **Default display** The default display mode of object filters will be visible on `/catalogue/`: ``` # /catalogue/index.md: # object-filter-display: default ``` ![localhost_8080_catalogue_ (12)](https://github.com/thegetty/quire/assets/7109269/7070e55a-df32-4b9d-a7c1-93e9cefbac25) **Collapsible display** When there are many (more than 8 or so) options, `collapsible` might be a better choice for `object-filter-display`: ``` # /catalogue/index.md: object-filter-display: collapsible ``` ![localhost_8080_catalogue_ (13)](https://github.com/thegetty/quire/assets/7109269/cd7e98b9-1e28-4c4e-a6b4-1ff113e45cbd) **Sticky display** When there are few (no more than 3 or 4) options, `sticky` might be a desirable option for `object-filter-display`: ``` # /catalogue/index.md: object-filter-display: sticky ``` ![localhost_8080_catalogue_ (14)](https://github.com/thegetty/quire/assets/7109269/48206f15-2077-452d-9994-a4f9eb753075)UX Presentation