import { View } from "@tarojs/components";
import style from './index.module.less';
export interface IndexProps {
  text: string,
  icon: ()=> JSX.Element
  onClick?: ()=> void
}

const Index = ({ text, icon, onClick }: IndexProps) => {
  
  return (
    <View className={style.roundedLabel} onClick={(e)=> {
      e.stopPropagation()
      onClick && onClick()
    }}>
      <View className={style.roundedLabelIcon}>{icon()}</View><View>{text}</View>
    </View>
  )
}

export default Index;