import {View, Image} from '@tarojs/components'
import style from './index.module.less'
import IconChecked from '@/images/checked.png'

interface Props {
  checked?: boolean
  disabled?: boolean
  checkbox?: boolean
  theme?: 'dark' | 'light'
}
const index = ({ checked = false, disabled, checkbox=false, theme ='dark' }: Props) => {
  if(checkbox){
    return (
      <View className={`${style.radio} ${theme === 'light' ? style.lightRadio:''} ${checked ? style.checked :''} ${disabled ? style.innerDisabled : ''}`}>
        <View className={`${disabled ? style.innerDisabledCheckBox : style.innerCheckbox}`}>
          <Image src={IconChecked} className={checked ? style.checkboxIconChecked : style.checkboxIcon}></Image>
        </View>
    </View>
    )
  }
  return (
    <View className={`${style.radio} ${theme === 'light'?style.lightRadio : ''} ${checked ? style.checked :''} ${disabled ? style.innerDisabled : ''}`}>
      <View className={`${disabled ? style.innerDisabled : style.inner}`}>
      </View>
    </View>
  )
}
export default index
