import PropTypes from 'prop-types'
import React from 'react'

const MTIcon = React.forwardRef((props, ref) => {
  const {
    type,
    align,
    className,
    ...otherProps
  } = props
  const alignClass = align ? 'ia' : ''
  return (
    <span
      ref={ ref }
      className={ `icon-${type} ${alignClass} ${className}` }
      { ...otherProps }
    />
  )
})

MTIcon.defaultProps = {
  align: true,
  className: '',
}

MTIcon.propTypes = {
  align: PropTypes.bool,
  className: PropTypes.string,
}

export default MTIcon
