diff options
Diffstat (limited to 'app/assets/javascripts/components/features/ui/components/character_counter.jsx')
-rw-r--r-- | app/assets/javascripts/components/features/ui/components/character_counter.jsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/assets/javascripts/components/features/ui/components/character_counter.jsx b/app/assets/javascripts/components/features/ui/components/character_counter.jsx index dd9218844..f0c1b7c8d 100644 --- a/app/assets/javascripts/components/features/ui/components/character_counter.jsx +++ b/app/assets/javascripts/components/features/ui/components/character_counter.jsx @@ -3,15 +3,18 @@ import PureRenderMixin from 'react-addons-pure-render-mixin'; const CharacterCounter = React.createClass({ propTypes: { - text: React.PropTypes.string.isRequired + 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' }}> - {this.props.text.length} + {diff} </span> ); } |