@nymdev/clay-component-list
v0.0.2
Published
A component that embeds other components!
Downloads
5
Readme
clay-component-list
A component that embeds other components!
Install
npm install --save @nymdev/clay-component-list
This component relies on the getContent
filter from nunjucks-filters, the embed
function from multiplex-templates, and the getTemplate
method added by amphora
itself.
multiplex-templates
is a dependency of amphora
, but nunjucks-filters
needs to be added to your project (and passed into amphora
when it instantiates) to use it.
Usage
Once you install it, it will be automatically recognized by amphora
. Embed a list of components by passing them into this one, e.g.
<section class="primary">{{ embed(state.getTemplate('clay-component-list'), primary, state) | safe }}</section>
Where primary
is an array of component objects or page areas:
[{
_ref: '/components/header',
title: 'My Cool Blog'
}, {
_ref: '/components/article/instances/first-article',
more: 'data',
goes: 'here'
}]