Rough example of component implementation. Heavily influenced by React's PropType implementation (Typechecking With PropTypes)
{% stackrComponent props {
title: Stackr.string(),
headline: Stackr.string(),
bodyHtml: Stackr.string(),
ctaGroup: Stackr.arrayOf(Stackr.shape({
label: Stackr.string('Learn More'),
url: Stackr.string('#'),
target: Stackr.string('_self'),
})),
padding: Stackr.list('default', ['default', 'none']),
} %}
Allow default values
title: Stackr.string('Default Title')
Allow specifying the shapes of objects
ctaGroup: Stackr.shape({
label: Stackr.string('Learn More'),
url: Stackr.string('#'),
target: Stackr.string('_self'),
}),
Allow specifying the shapes of collections
ctaGroup: Stackr.arrayOf(
Stackr.shape({
label: Stackr.string('Learn More'),
url: Stackr.string('#'),
target: Stackr.string('_self'),
})
),
Allow specifying enums
padding: Stackr.list('default', ['default', 'none']),
Long term, it would be ideal if the CMS could read these definitions and present a UI to the admin for configuring this block. This might require that the user creates and specifies the "Field Type" that should be presented allowing the CMS to control the settings associated with a field.
Rough example of component implementation. Heavily influenced by React's PropType implementation (Typechecking With PropTypes)
Allow default values
Allow specifying the shapes of objects
Allow specifying the shapes of collections
Allow specifying enums
Long term, it would be ideal if the CMS could read these definitions and present a UI to the admin for configuring this block. This might require that the user creates and specifies the "Field Type" that should be presented allowing the CMS to control the settings associated with a field.