UNPKG

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).

26 lines (24 loc) 623 B
import { $$ } from '../dom' export default function Link (props) { const el = $$('a').addClass('sc-link') const { style, inlineBlock, inverted } = props if (style) { el.addClass('sm-style-' + style) } if (inlineBlock) { el.addClass('sm-inline-block') } if (inverted) { el.addClass('sm-inverted') } const children = props.children const attributes = Object.assign({}, props) // TODO: can we do this more elegantly? delete attributes.style delete attributes.inverted delete attributes.inlineBlock delete attributes.children el.attr(attributes) el.append(children) return el }