source: imaps-frontend/node_modules/nano-css/addon/useStyles.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: 654 bytes
RevLine 
[d565449]1'use strict';
2
3exports.addon = function (renderer) {
4 if (process.env.NODE_ENV !== 'production') {
5 require('./__dev__/warnOnMissingDependencies')('useStyles', renderer, ['sheet']);
6 }
7
8 renderer.useStyles = function (map, fn, block) {
9 block = block || fn.displayName || fn.name;
10
11 var styles = renderer.sheet(map, block);
12 var Component = function (props) {
13 return fn(props, styles);
14 };
15
16 if (process.env.NODE_ENV !== 'production') {
17 if (block) {
18 Component.displayName = 'useStyles(' + block + ')';
19 }
20 }
21
22 return Component;
23 };
24};
Note: See TracBrowser for help on using the repository browser.