Skip to content

TopicComponent

andy.rothwell edited this page Oct 4, 2018 · 10 revisions

TopicComponent

NOTE: this component type should be renamed now that we have made being included in a topic optional for any component. This is issue 5.

All components have the mixin "TopicComponent" which adds a set of props to each of them:

prop definition or description
slots
options
item

It also adds the function evaluateSlot() to each component in the library.

By mixing this into all components, all templates, functions, computeds, and other things in the components can fairly uniformly be written to use these props and the evaluateSlot() function.

In other topicComponents

Any component will automatically have a "slots", "options", and "item" object. If the component was included as part of a TopicComponentGroup, these objects will be full of values from a config file.

In a Mapboard config file

This allows you to include "slots", "options", and "item" parameters in a component in a config. For instance, to add text to a callout, create a slots object, and create a parameter called "text" inside of the slots:

components: [
  {
    type: 'callout',
    slots: {
      text: '\
        Property assessment and sale information for this address. Source: Office of Property Assessments (OPA). OPA was formerly a part of the Bureau of Revision of Taxes (BRT) and some City records may still use that name.\
      '
    }
  },
Clone this wiki locally