/**
 * SubmitField component
 *
 * Generated by coz on 2016-10-14,
 * from a template provided by apeman-asset-templates.
 *
 * @function SubmitField
 */
'use strict'

import React from 'react'
import defineDebug from 'debug'
import classnames from 'classnames'
import {
  ApField,
  ApFieldLabel, ApFieldValue,
  ApButton, ApButtonGroup
} from 'apeman-react-basic'

const debug = defineDebug('project:fragment:submit-field')

/** @lends SubmitField */
const SubmitField = ({
  label,
  id,
  onSubmit,
  primary = true,
  values = {},
  icon
}) => (
  <ApField center className='submit-field'>
    <ApButtonGroup>
      <ApButton id={ id }
                onTap={ () => onSubmit(values) }
                wide
                className='submit-button'
                primary={ primary }
      >
        {
          icon ? (
              <i className={ classnames(icon, 'submit-button-icon') }/>
            ) : null
        }
        <span className="submit-button-text">{ label }</span>
      </ApButton>
    </ApButtonGroup>
  </ApField>
)

export default SubmitField
