mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
24 lines
474 B
JavaScript
24 lines
474 B
JavaScript
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;
|