Skip to content

Commit f89620e

Browse files
committed
pass props down to <span> (for styling)
1 parent f9527ea commit f89620e

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

Diff for: examples/components/currency.js

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ module.exports = React.createClass({
4242
EUR, 150, style: "code" - <FormatCurrency locale={this.state.locale} currency="EUR" options={{ style: "code" }}>{150}</FormatCurrency>
4343
<br/>
4444
EUR, 1.491, round: "ceil" - <FormatCurrency locale={this.state.locale} currency="EUR" options={{ round: "ceil" }}>{1.491}</FormatCurrency>
45+
<br/>
46+
EUR, 150, style: "code", with CSS class -
47+
<FormatCurrency className='firstClass' locale={this.state.locale} currency="EUR" options={{ style: "code" }}>{150}</FormatCurrency>
4548
</div>
4649
);
4750
}

Diff for: examples/components/dates.js

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ module.exports = React.createClass({
3030
time: "medium" - <FormatDate locale={this.state.locale} pattern={{ time: "medium" }}>{new Date()}</FormatDate>
3131
<br/>
3232
datetime: "medium" - <FormatDate locale={this.state.locale} pattern={{ datetime: 'medium' }}>{new Date()}</FormatDate>
33+
<br/>
34+
datetime: "medium" with CSS class -
35+
<FormatDate className='secondClass' locale={this.state.locale} pattern={{ datetime: 'medium' }}>{new Date()}</FormatDate>
3336
</div>
3437
);
3538
}

Diff for: examples/components/messages.js

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ module.exports = React.createClass({
3333
<FormatMessage locale={this.state.locale}>Bye</FormatMessage>
3434
<br/>
3535
<FormatMessage locale={this.state.locale}>Hi/Bye</FormatMessage>
36+
<h3>Default messages with style</h3>
37+
<FormatMessage style={{color: 'red'}} locale={this.state.locale}>
38+
Hi
39+
</FormatMessage>
40+
<br/>
41+
<FormatMessage style={{color: 'blue'}} locale={this.state.locale}>
42+
Bye
43+
</FormatMessage>
3644
<h3>Variable Replacement</h3>
3745
["Wolfgang", "Amadeus", "Mozart"] - <FormatMessage locale={this.state.locale} path="variables/hello" variables={["Wolfgang", "Amadeus", "Mozart"]} />
3846
<br/>

Diff for: examples/components/numbers.js

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ module.exports = React.createClass({
3333
<br/>
3434
0.5, style: 'percent' - <FormatNumber locale={this.state.locale} options={{ style: 'percent' }}>{0.5}</FormatNumber>
3535
<br/>
36+
0.5, style: 'percent' with inline styles -
37+
<FormatNumber style={{fontWeight: 'bold', color: 'chocolate'}} locale={this.state.locale} options={{ style: 'percent' }}>{0.5}</FormatNumber>
3638
</div>
3739
);
3840
}

Diff for: examples/index.html

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
<head>
44
<meta http-equiv='Content-type' content='text/html; charset=utf-8'>
55
<title>Examples</title>
6+
<style>
7+
.firstClass {
8+
color: green;
9+
font-weight: bold;
10+
}
11+
12+
.secondClass {
13+
color: slategray;
14+
font-size: 20px;
15+
}
16+
</style>
617
</head>
718
<body>
819
<h1>Currency</h1>
@@ -15,4 +26,4 @@ <h1>Numbers</h1>
1526
<div id="numbers"></div>
1627
<script src="app.js"></script>
1728
</body>
18-
</html>
29+
</html>

Diff for: src/generator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function generator(fn, argArray, options) {
3333
}
3434

3535
beforeFormat.call(this);
36-
return React.DOM.span(null, afterFormat.call(this, this.format()));
36+
return React.DOM.span(componentProps, afterFormat.call(this, this.format()));
3737
}
3838
}
3939
};

0 commit comments

Comments
 (0)