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

41 lines (31 loc) 831 B
import { Component } from '../../ui' /** Layout component for simple layout tasks, without having to write CSS @class @component @prop {String} width 'small', 'medium', 'large' and 'full' @prop {String} [textAlign] 'center', 'left' or 'right' @prop {String} [noPadding] No padding around layout, will fill the whole space @example ```js var form = $$(Layout, { width: 'large', textAlign: 'center' }); ``` */ class Layout extends Component { render($$) { let el = $$('div').addClass('sc-layout') el.addClass('sm-width-'+this.props.width) if (this.props.textAlign) { el.addClass('sm-text-align-'+this.props.textAlign) } if (this.props.noPadding) { el.addClass('sm-no-padding') } el.append(this.props.children) return el } } export default Layout