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


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"
        text={ this.getLinks() }
        type="text"
      />
    )
  }
}

export default LinksControl


Remove max-length on links control
Remove max-length on links control

The `max-length` attribute was inadvertently added.

[Finishes: #119027729](https://www.pivotaltracker.com/story/show/119027729)
[#119014219](https://www.pivotaltracker.com/story/show/119014219)

