
import React from 'react'
import { View, Image, Text } from '@tarojs/components'
import './style.less'

export default (props) => {
  const { icon, text, onClick } = props


  const handleClick = (e) => {
    if (onClick) {
      e.stopPropagation()
      onClick(e);
    }
  }

  return (
    <View className='cpn-action cpn-icon-action'>
      <View onClick={handleClick}>
        <Image src={icon} />
        {text?<Text>{text}</Text>:null}
      </View>
    </View>
  )
}
