import React, { Component, PropTypes } from 'react'
import FormControl from './FormControl'

/* eslint-disable react/prefer-stateless-function */
class LinksControl extends Component {

  static propTypes = {
    text: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.array,
    ]),
  }

  static defaultProps = {
    className: 'LinksControl',
    id: 'external_links',
    label: 'Links',
    name: 'user[links]',
    placeholder: 'Links (optional)',
  }

  getLinks() {
    const { text } = this.props
    const links = text || ''
    if (typeof links === 'string') {
      return links
    }
    return links.map((link) => link.text).join(', ')
  }

  render() {
    return (
      <FormControl
        { ...this.props }
        autoCapitalize="off"
        autoCorrect="off"
        maxLength="50"
        text={ this.getLinks() }
        type="text"
      />
    )
  }
}

export default LinksControl


@@ -790,31 +790,8 @@
 ff%22%0A
-        maxLength=%2250%22%0A
     

Remove max-length on links control