Comparing version 0.1.2 to 0.1.3
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = require('react'); | ||
@@ -16,7 +18,8 @@ | ||
var _utils = require('./utils'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var Icon = function Icon(_ref) { | ||
var type = _ref.type; | ||
return _react2.default.createElement('i', { className: (0, _classnames2.default)('fa', 'fa-' + type) }); | ||
var Icon = function Icon(props) { | ||
return _react2.default.createElement('i', _extends({ className: _getClasses(props) }, (0, _utils.getRemainingProps)(Icon, props))); | ||
}; | ||
@@ -28,3 +31,29 @@ | ||
Icon.propTypes = { | ||
type: _react.PropTypes.string.isRequired | ||
}; | ||
type: _react.PropTypes.string.isRequired, | ||
className: _react.PropTypes.string, | ||
size2x: _react.PropTypes.bool, | ||
size4x: _react.PropTypes.bool, | ||
spin: _react.PropTypes.bool | ||
}; | ||
function _getClasses(props) { | ||
var classes = ['fa', 'fa-' + props.type]; | ||
if (props.size2x) { | ||
classes.push('fa-2x'); | ||
} | ||
if (props.size4x) { | ||
classes.push('fa-4x'); | ||
} | ||
if (props.spin) { | ||
classes.push('fa-spin'); | ||
} | ||
if (props.className) { | ||
classes.push(props.className); | ||
} | ||
return (0, _classnames2.default)(classes); | ||
} |
{ | ||
"name": "cyprex-ui", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Cyprex basic UI components", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
150889
302