import { useState, useEffect } from 'react';
import { Table } from 'antd';
const TableCom = (props) => {
  const [obj, setObj] = useState({});
  const { columns = [], data = [], loading = false } = props;
  useEffect(() => {
    let height = document.querySelector('.ant-table-tbody')?.clientHeight || 0;
    let x = true;
    if (height > 600) {
      setObj({ x, y: 600 });
    } else {
      setObj({ x });
    }
  }, [data.length]);
  return (
    <Table
      // scroll={obj}
      columns={columns}
      rowKey={(record) => record.id}
      dataSource={data}
      loading={loading}
      pagination={false}
    ></Table>
  );
};
export default TableCom;
