Skip to content

Commit 6a907b2

Browse files
committed
Updated demo. “use strict”.
1 parent 96ca8e1 commit 6a907b2

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

index.html

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727

2828
</head>
2929
<body>
30+
<a href="https://github.com/RickWong/ReactStyle"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
31+
32+
<h2>React Style component</h2>
33+
<p>React.js Style component allows you to cascade CSS stylesheets on your components, automatically namespacing them.</p>
34+
3035
<div id="profile0"></div>
3136
<div id="profile1"></div>
3237
<div id="profile2"></div>
@@ -58,7 +63,7 @@
5863
}
5964
">
6065
<div className="card">
61-
<img src="mao.jpg" />
66+
<img src={this.props.image || 'mao.jpg'} />
6267
<p>{this.props.name || 'Default Mao'}</p>
6368
</div>
6469
</Style>
@@ -96,7 +101,7 @@
96101
display: inline;
97102
}
98103
">
99-
<Profile name={this.props.name} />
104+
{this.transferPropsTo(<Profile />)}
100105
</Style>
101106
);
102107
}
@@ -133,7 +138,7 @@
133138
display: block;
134139
}
135140
">
136-
<Profile name={this.props.name} />
141+
{this.transferPropsTo(<Profile />)}
137142
</Style>
138143
);
139144
}
@@ -169,18 +174,19 @@
169174
margin: 0;
170175
padding: 10px;
171176
bottom: 0;
177+
font-weight: bold;
172178
}
173179
">
174-
<Profile name={this.props.name} />
180+
{this.transferPropsTo(<Profile />)}
175181
</Style>
176182
);
177183
}
178184
});
179185

180186
React.renderComponent(<Profile />, document.getElementById('profile0'));
181-
React.renderComponent(<FacebookProfile name="Facebook Mao" />, document.getElementById('profile1'));
182-
React.renderComponent(<GoogleProfile name="Google Mao" />, document.getElementById('profile2'));
183-
React.renderComponent(<TwitterProfile name="Twitter Mao" />, document.getElementById('profile3'));
187+
React.renderComponent(<FacebookProfile name="Facebook Mao" image="mao2.png" />, document.getElementById('profile1'));
188+
React.renderComponent(<GoogleProfile name="Google Mao" image="mao3.png" />, document.getElementById('profile2'));
189+
React.renderComponent(<TwitterProfile name="Twitter Mao" image="mao4.png" />, document.getElementById('profile3'));
184190
</script>
185191
</body>
186192
</html>

mao2.png

890 KB
Loading

mao3.png

1.53 MB
Loading

mao4.png

1.57 MB
Loading

react-style-0.1.0.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright 2014 Rick Wong
66
* Released under the MIT license
77
*/
8-
(function (root, factory) {
8+
!(function (root, factory) {
99
if (typeof define === 'function' && define.amd) {
1010
define(['react'], factory);
1111
} else if (typeof exports === 'object') {
@@ -14,6 +14,8 @@
1414
root.Style = factory(root.React);
1515
}
1616
}(this, function (React) {
17+
"use strict";
18+
1719
return React.createClass({
1820
displayName: 'Style',
1921
componentWillMount: function () {

0 commit comments

Comments
 (0)