UNPKG

apeman-react-section

Version:
58 lines (45 loc) 894 B
/** * Section component. * @class ApSection */ 'use strict' import React, {PropTypes as types} from 'react' import classnames from 'classnames' import {ApUUIDMixin} from 'apeman-react-mixin-uuid' /** @lends ApSection */ const ApSection = React.createClass({ // -------------------- // Specs // -------------------- propTypes: { id: types.string }, mixins: [ ApUUIDMixin ], statics: {}, getInitialState () { return {} }, getDefaultProps () { return { id: null } }, render () { const s = this let { props } = s let { id } = props if (!id) { id = s.uuid } return ( <section className={ classnames('ap-section', props.className) } id={ id } style={ Object.assign({}, props.style) }> { props.children } </section> ) } }) export default ApSection