ensure maxLength on topic titles

This commit is contained in:
Connor Turland 2017-02-26 16:37:58 +00:00
parent f3652b9ca6
commit ec57d8d392

View file

@ -1,10 +1,12 @@
import React, { Component, PropTypes } from 'react' import React, { Component, PropTypes } from 'react'
import { RIETextArea } from 'riek' import { RIETextArea } from 'riek'
const maxTitleLength = 140
class Title extends Component { class Title extends Component {
nameCounterText() { nameCounterText() {
// for some reason, there's an error if this isn't inside a function // for some reason, there's an error if this isn't inside a function
return `${this.props.name.length}/140` return `${this.props.name.length}/${maxTitleLength.toString()}`
} }
render() { render() {
@ -19,6 +21,7 @@ class Title extends Component {
id="titleActivator" id="titleActivator"
classEditing="riek-editing" classEditing="riek-editing"
editProps={{ editProps={{
maxLength: maxTitleLength,
onKeyPress: e => { onKeyPress: e => {
const ENTER = 13 const ENTER = 13
if (e.which === ENTER) { if (e.which === ENTER) {