main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
866 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | exports.addon = function (renderer) {
|
---|
| 4 | if (process.env.NODE_ENV !== 'production') {
|
---|
| 5 | require('./__dev__/warnOnMissingDependencies')('withStyles', renderer, ['sheet']);
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | renderer.withStyles = 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 | if (process.env.NODE_ENV !== 'production') {
|
---|
| 14 | return fn(Object.assign({}, props, {
|
---|
| 15 | styles: styles
|
---|
| 16 | }));
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | props.styles = styles;
|
---|
| 20 |
|
---|
| 21 | return fn(props);
|
---|
| 22 | };
|
---|
| 23 |
|
---|
| 24 | if (process.env.NODE_ENV !== 'production') {
|
---|
| 25 | if (block) {
|
---|
| 26 | Component.displayName = 'withStyles(' + block + ')';
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | return Component;
|
---|
| 31 | };
|
---|
| 32 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.