2017-01-25 14:03:20 -05:00
|
|
|
import React from 'react'
|
|
|
|
import { RIETextArea } from 'riek'
|
|
|
|
|
|
|
|
const Title = (props) => {
|
2017-01-28 15:52:00 -05:00
|
|
|
if (props.authorizedToEdit) {
|
|
|
|
return (
|
|
|
|
<span className="title">
|
|
|
|
<RIETextArea value={props.name}
|
|
|
|
propName="name"
|
|
|
|
change={props.onChange}
|
|
|
|
className="titleWrapper"
|
|
|
|
id="titleActivator"
|
|
|
|
classEditing="riek-editing"
|
|
|
|
editProps={{
|
|
|
|
onKeyPress: e => {
|
|
|
|
const ENTER = 13
|
|
|
|
if (e.which === ENTER) {
|
|
|
|
e.preventDefault()
|
|
|
|
props.onChange({ name: e.target.value })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<span className="title">
|
|
|
|
<span className="titleWrapper">
|
|
|
|
{props.name}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|
2017-01-25 14:03:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Title.propTypes = {
|
|
|
|
* name: PropTypes.string,
|
2017-01-28 15:52:00 -05:00
|
|
|
* onChange: PropTypes.func,
|
|
|
|
* authorizedToEdit: PropTypes.bool
|
2017-01-25 14:03:20 -05:00
|
|
|
* }
|
|
|
|
*/
|
|
|
|
|
|
|
|
export default Title
|