-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathindex.js
42 lines (37 loc) · 1.14 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var React = require('react');
var D = React.DOM;
var createReactClass = require('create-react-class');
var Symbol = require('./symbol');
var symbol = React.createFactory(Symbol);
var TransitiveNumber = createReactClass({
getDefaultProps: function() {
return {
className: null,
enableInitialAnimation: false
};
},
render: function() {
var value = this.props.children.toString();
// Invert animation direction when negative number is supplied.
var inverted = value[0] === '-';
return D.span(
{
className: this.props.className,
style: {
whiteSpace: 'pre'
}
},
value
.split('')
.map(function(s, index) {
return symbol({
symbol: s,
inverted: inverted,
enableInitialAnimation: this.props.enableInitialAnimation,
key: index
});
}, this)
);
}
});
module.exports = TransitiveNumber;