@ysmood/material-ui
Version:
Material Design UI components built with React
34 lines (29 loc) • 838 B
JavaScript
var React = require('react/addons');
var AutoPrefix = require('../styles/auto-prefix');
var Extend = require('../utils/extend');
/**
* @params:
* styles = Current styles.
* props = New style properties that will override the current style.
*/
module.exports = {
propTypes: {
style: React.PropTypes.object
},
mergeStyles: function() {
var args = Array.prototype.slice.call(arguments, 0);
var base = args[0];
for (var i = 1; i < args.length; i++) {
if (args[i]) base = Extend(base, args[i]);
}
return base;
},
/**
* loops through all properties defined in the first argument, so overrides
* of undefined properties will not take place.
*/
mergeAndPrefix: function() {
var mergedStyles = this.mergeStyles.apply(this, arguments);
return AutoPrefix.all(mergedStyles);
},
}