source: imaps-frontend/node_modules/nano-css/addon/component.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 893 bytes
Line 
1'use strict';
2
3var React = require('react');
4var Component = React.Component;
5var transformComponentStatic = require('./util/transformComponentStatic');
6var transformComponentDynamic = require('./util/transformComponentDynamic');
7
8exports.addon = function (renderer) {
9 if (process.env.NODE_ENV !== 'production') {
10 require('./__dev__/warnOnMissingDependencies')('component', renderer, ['rule', 'cache']);
11 }
12
13 function CssComponent (props, context) {
14 Component.call(this, props, context);
15
16 var Comp = this.constructor;
17
18 if (Comp.css) transformComponentStatic(renderer, Comp.prototype, Comp.css);
19 if (this.css) transformComponentDynamic(renderer, Comp, this.css.bind(this));
20 }
21
22 CssComponent.prototype = Object.create(Component.prototype);
23 CssComponent.prototype.constructor = CssComponent;
24
25 renderer.Component = CssComponent;
26};
Note: See TracBrowser for help on using the repository browser.