source: imaps-frontend/node_modules/nano-css/addon/style.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: 933 bytes
Line 
1'use strict';
2
3exports.addon = function (renderer) {
4 if (process.env.NODE_ENV !== 'production') {
5 require('./__dev__/warnOnMissingDependencies')('style', renderer, ['jsx']);
6 }
7
8 renderer.style = function (fn, styles, dynamicTemplate, block) {
9 var jsxComponent = renderer.jsx(fn, styles, block);
10
11 var Component = function(props) {
12 var copy = props;
13
14 if (process.env.NODE_ENV !== 'production') {
15 copy = Object.assign({}, props);
16 }
17
18 if (dynamicTemplate) {
19 copy.css = dynamicTemplate(props);
20 }
21
22 return jsxComponent(copy);
23 };
24
25 if (process.env.NODE_ENV !== 'production') {
26 if (block || (typeof fn === 'function')) {
27 Component.displayName = 'style(' + (block || fn.displayName || fn.name) + ')';
28 }
29 }
30
31 return Component;
32 };
33};
Note: See TracBrowser for help on using the repository browser.