Skip to content

Commit fe22f7a

Browse files
author
Rick
committed
Pass-through all other props.
1 parent e783363 commit fe22f7a

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-inline-css",
33
"description": "Inline CSS in your React components, namespaced automatically.",
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"license": "BSD-3-Clause",
66
"repository": {
77
"type": "git",
@@ -23,7 +23,7 @@
2323
"watch": "concurrent --kill-others 'npm run watch-client' 'npm run localhost'"
2424
},
2525
"dependencies": {
26-
"react": ">= 0.14.0-rc1"
26+
"react": ">= 0.14.0"
2727
},
2828
"devDependencies": {
2929
"babel-core": "5.8.24",

src/react-inline-css.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* @copyright © 2015, Rick Wong. All rights reserved.
33
*/
4-
var React = require("react");
5-
4+
var React = require("react");
5+
var assign = React.__spread;
66
var refCounter = 0;
77

88
/**
@@ -11,11 +11,11 @@ var refCounter = 0;
1111
var InlineCss = React.createClass({
1212
displayName: "InlineCss",
1313
propTypes: {
14+
namespace: React.PropTypes.string,
1415
componentName: React.PropTypes.string,
15-
className: React.PropTypes.string,
16-
namespace: React.PropTypes.string,
17-
stylesheet: React.PropTypes.string.isRequired,
18-
wrapper: React.PropTypes.string
16+
stylesheet: React.PropTypes.string.isRequired,
17+
className: React.PropTypes.string,
18+
wrapper: React.PropTypes.string
1919
},
2020
_transformSheet: function (stylesheet, componentName, namespace) {
2121
return stylesheet.
@@ -30,15 +30,22 @@ var InlineCss = React.createClass({
3030
);
3131
},
3232
render: function () {
33-
var componentName = this.props.componentName || "&";
34-
var className = this.props.className;
3533
var namespace = this.props.namespace || "InlineCss-" + refCounter++;
34+
var componentName = this.props.componentName || "&";
3635
var stylesheet = this._transformSheet(this.props.stylesheet, componentName, namespace);
3736
var Wrapper = this.props.wrapper || "div";
3837

38+
var wrapperProps = assign({}, this.props, {
39+
namespace: undefined,
40+
componentName: undefined,
41+
stylesheet: undefined,
42+
wrapper: undefined,
43+
id: namespace
44+
});
45+
3946
return React.createElement(
4047
Wrapper,
41-
{id: namespace, className: className},
48+
wrapperProps,
4249
this.props.children,
4350
React.createElement("style", {
4451
scoped: true,

0 commit comments

Comments
 (0)