import { length } from 'stringz' export default class CharacterCounter extends PureComponent { static propTypes = { text: PropTypes.string.isRequired, max: PropTypes.number.isRequired, } render () { const radius = 12 const circumference = 2 * Math.PI * radius const diff = length(this.props.text) / this.props.max const dashoffset = circumference * (1 - diff) return (
) } }