blob: f0c1b7c8d86e70d2488e83c879c09e701bf7dfc1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
const CharacterCounter = React.createClass({
propTypes: {
text: React.PropTypes.string.isRequired,
max: React.PropTypes.number.isRequired
},
mixins: [PureRenderMixin],
render () {
const diff = this.props.max - this.props.text.length;
return (
<span style={{ fontSize: '16px', cursor: 'default' }}>
{diff}
</span>
);
}
});
export default CharacterCounter;
|