import React, { Component } from 'react'; import './index.less'; import RadioItem from '../RadioItem'; export default class Answer extends Component { render() { return <div className="answer">{this.renderTable()}</div>; } renderList() { const { list = [] } = this.props; return ( <div className="list"> {list.map(item => { return ( <div className="item"> <RadioItem checked onClick={() => {}} /> <div className="text">{item}</div> </div> ); })} </div> ); } renderTable() { const { list = [] } = this.props; return ( <table border="1" bordercolor="#d8d8d8"> <thead> <tr className="bg"> <th align="center" width="100" className="t-c"> Both acce </th> <th align="center" width="100" className="t-c"> Otherwise </th> <th /> </tr> </thead> <tbody> {list.map(item => { return ( <tr> <td align="center" className="bg"> <RadioItem checked onClick={() => {}} /> </td> <td align="center" className="bg"> <RadioItem checked onClick={() => {}} /> </td> <td>{item}</td> </tr> ); })} </tbody> </table> ); } }