substance
Version:
Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing system. It is developed to power our online editing platform [Substance](http://substance.io).
24 lines (21 loc) • 700 B
JavaScript
import { $$ } from '../dom'
import AffiliationComponent from './AffiliationComponent'
import PropertyComponent from './PropertyComponent'
export default class AffiliationsListComponent extends PropertyComponent {
getPath () {
return [this.props.node.id, 'affiliations']
}
render () {
const node = this.props.node
const affiliations = node.resolve('affiliations')
const el = $$('div', { class: 'sc-affiliations-list' })
if (affiliations && affiliations.length > 0) {
el.append(
...affiliations.map(affiliation => $$(AffiliationComponent, { node: affiliation }).ref(affiliation.id))
)
} else {
el.addClass('sm-empty')
}
return el
}
}