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:
734 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | module.exports = function (renderer, prototype, styles, block) {
|
---|
| 4 | var render_ = prototype.render;
|
---|
| 5 | var className = '';
|
---|
| 6 |
|
---|
| 7 | prototype.render = function () {
|
---|
| 8 | var element = render_.call(this);
|
---|
| 9 |
|
---|
| 10 | if (element) {
|
---|
| 11 | if (!className) {
|
---|
| 12 | className = renderer.rule(styles, block);
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | if (process.env.NODE_ENV === 'production') {
|
---|
| 16 | element.props.className = (element.props.className || '') + className;
|
---|
| 17 | } else {
|
---|
| 18 | element = require('react').cloneElement(element, {
|
---|
| 19 | className: (element.props.className || '') + className,
|
---|
| 20 | });
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | return element;
|
---|
| 25 | };
|
---|
| 26 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.