import React, { Component } from 'react';
import './index.less';
import Select from '../Select';

export default class AnswerTable extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentWillMount() {}

  componentWillUnmount() {}

  render() {
    const { columns = [], data = [], list = [] } = this.props;
    return (
      <div className="answer-table">
        <div className="select-line">
          <Select size="basic" theme="default" list={list} />
        </div>
        <table border="1" bordercolor="#d8d8d8">
          <thead>
            <tr className="bg">
              {columns.map(item => {
                return <th>{item.title}</th>;
              })}
            </tr>
          </thead>
          <tbody>
            {data.map(row => {
              return (
                <tr>
                  {columns.map(item => {
                    return <td>{row[item.key]}</td>;
                  })}
                </tr>
              );
            })}
          </tbody>
        </table>
      </div>
    );
  }
}