text: import Form from '@admin/components/form'
  import PropTypes from 'prop-types'
  import React from 'react'
  
  class New extends React.Component {
  
    static propTypes = {
      item: PropTypes.object,
      onBack: PropTypes.func,
      onDone: PropTypes.func
    }
  
    _handleBack = this._handleBack.bind(this)
    _handleDone = this._handleDone.bind(this)
  
    render() {
      return <Form { ...this._getForm() } />
    }
  
    _getForm() {
      const { item } = this.props
      return {
        title: 't(Edit Color)',
        cancelIcon: 'chevron-left',
        onCancel: this._handleBack,
        onSuccess: this._handleDone,
        sections: [
          {
            fields: [
              { name: 'code', type: 'hidden', value: item.code },
              { label: 't(Name)', name: 'name', type: 'tokenfield', placeholder: 'Enter Name', required: true, defaultValue: item.name },
              { label: 't(Color)', name: 'hex', type: 'colorfield', required: true, defaultValue: item.hex }
            ]
          }
        ]
      }
    }
  
    _handleBack() {
      this.props.onBack()
    }
  
    _handleDone(color) {
      this.props.onDone(color)
    }
  
  }
  
  export default New
  