import React from "react"
import style from './index.less'
import { CheckCircleFilled } from "@ant-design/icons"

/**
 * 新的Radio样式
 * @param param0 
 * @returns 
 */
const New1Radio: React.FC<PULLIN.FormItemDataNewProps> = ({ data = [], value, onChange, id }) => {

    return <div className={style.new1Radio} id={id}>
        {data.map((item, index) => <div
            onClick={() => {
                if (!item?.disabled) onChange?.(item?.value)
            }}
            key={item?.value || index}
            className={`${value === item.value ? style.newRadioActive : ''} ${item?.disabled ? style.disabled : ''}`}
        >
            <div><CheckCircleFilled /></div>
            <span>{item?.label || item?.value || index}</span>
        </div>)}
    </div>
}

export default React.memo(New1Radio)