import { View } from "@tarojs/components";

interface IProps {
  onClick?: ()=> void
  disabled?: boolean
  className?: string
  type?: 'main'|'normal'
  children: JSX.Element|JSX.Element[]|string
}
export default function ButtonMain({ onClick, type = 'main', disabled = false, className='', children }:IProps) {
  const typeClass = type === 'main'? 'button-primary' : ''
  const handleClick = ()=> {
    if(!disabled){
      onClick && onClick()
    }
  }
  return (
    <View className={`button-rounded ${typeClass} ${disabled ? 'opacity-50': ''} ${className}`} onClick={handleClick}>{children}</View>
  );
}
