import React from "react";
import styles from "./index.css";
import {Scroll} from '../Animation/index';
const TableList = props => {
    const {data = {
        title:["名称","数据"],
        list:[{
            name:"abc",
            value:2
        }]
    }} = props,
    {title,list} = data;
    return (
        <div className={styles.textList+"  "+props.className} style={props.style}>
            {/*表头*/}
            <div className={`${styles.textListTitle} ${styles.tLItem}`}>
                {!!title.length && title.map((x, i) => {
                    return (
                        <span key={i} style={{textAlign: i%2?"right":"left"}}>{x}</span>
                    )
                })}
            </div>
            {/*表身*/}
            <Scroll
                style={{
                maxHeight: "100%",
                overflow: "hidden"
            }}>
                {!!list.length && list.map((row, i) => {
                    return (
                        <div className={`${styles.tLItem}`} key={i}>
                            <span>{row.name}</span>
                            <span style={{textAlign: "right"}}>{row.value}</span>
                        </div>
                    )
                })}
            </Scroll>
        </div>
    )
}
export {TableList}
export default TableList;