import {View} from '@tarojs/components'
import WemetaRadio from '@/components/WemetaRadio/index'
import style from './index.module.less'


export type TRadioItem = {
  text: string
  checked: boolean
}

interface Props {
  text: string
  checked?: boolean
  extra?: () => JSX.Element | JSX.Element[]
}
const index = ({ text, checked = false, extra }: Props) => {
  const renderExtraContent = () => {
    if(extra){
      return <View>{extra()}</View>
    }
    return 
  }  
  return (
    <View className={`${style.radioCardItem} ${checked ? style.checked :''}'`}>
      <View className={style.radioColumn}>
        <WemetaRadio checked={checked}></WemetaRadio>
      </View>
      <View className={style.radioContent}>
        <View className={style.radioText}>{text}</View>
        {renderExtraContent()}
      </View>
    </View>
  )
}
export default index