import { View } from "@tarojs/components";
import React, { Component } from "react";
import { AtFloatLayout, AtTimeline } from "taro-ui";

import 'taro-ui/dist/style/components/float-layout.scss';
import 'taro-ui/dist/style/components/button.scss';
import './index.less';


class InteractList extends Component {
  constructor(props) {
    super(props);
    this.state = {
    }

    this.handleClose = this.handleClose.bind(this);
  }

  handleClose() {
    this.props.onClose();
  }

  render() {
    const hisItems = this.props.list.map(record => {
        return { title: record.createTime, content: [record[this.props.type] || '空'] }
    })
    return (
        <AtFloatLayout isOpened={this.props.isOpened} title={this.props.title} scrollY onClose={this.handleClose}>
          <AtTimeline 
              pending 
              items={hisItems}
          >
          </AtTimeline>
        </AtFloatLayout>
    )
  }
}

export default InteractList;
