import React from 'react'
import { Text } from '@tarojs/components'
import classNames from 'classnames'
import './index.scss'

interface IconProps {
  type: string
  size?: number
  color?: string
  className?: string
  onClick?: () => void
}

const Icon: React.FC<IconProps> = ({ 
  type, 
  size = 16, 
  color, 
  className = '',
  onClick
}) => {
  return (
    <Text
      className={classNames('iconfont', `icon-${type}`, className)}
      style={{ 
        fontSize: `${size}px`, 
        color: color 
      }}
      onClick={onClick}
    />
  )
}

export default Icon