UNPKG

apeman-react-button

Version:
61 lines (46 loc) 1.19 kB
/** * Icon button component. * @constructor ApIconButton */ "use strict"; import React, {PropTypes as types} from 'react'; import classnames from 'classnames'; import {ApIcon} from 'apeman-react-icon'; import ApButton from './ap_button'; import {ApPureMixin} from 'apeman-react-mixins'; /** @lends ApIconButton */ let ApIconButton = React.createClass({ //-------------------- // Specs //-------------------- propTypes: { icon: types.string, text: types.string }, mixins: [ ApPureMixin ], getInitialState() { return {}; }, getDefaultProps() { return { icon: null, text: null } }, render() { let s = this; let props = s.props; return ( <ApButton className={classnames('ap-icon-button', props.className)} wide={false} {...props}> <ApIcon className={classnames('ap-icon-button-icon', props.icon, { })}/> <span className="ap-icon-button-text">{props.text}</span> </ApButton> ); } }); module.exports = ApIconButton;