import React, { Component } from 'react';
import { Radio as ARadio } from 'antd';
import './index.less';

export default class Radio extends Component {
  render() {
    const { select = [] } = this.props;
    return (
      <ARadio.Group className="radio-layout" {...this.props}>
        {select.map((i, index) => {
          if (typeof i === 'string') {
            return (
              <ARadio key={index} value={i}>
                {i}
              </ARadio>
            );
          }
          return (
            <ARadio key={index} value={i.value}>
              {i.name || i.title || i.label}
            </ARadio>
          );
        })}
      </ARadio.Group>
    );
  }
}
