import { EscrowListProps } from '../model/types';
import { ListDateGroup } from './list-date-group';

export const EscrowList = ({ 
  transactionCategory,
  listItems 
}: EscrowListProps) => {
  
  const getListDateGroup = () => {
    let rs = [];
    for (const [key, value] of Object.entries(listItems)) {
      rs.push(
        <ListDateGroup
          transactionCategory={ transactionCategory }
          key={ key }
          date={ key }
          items={ value }
        ></ListDateGroup>
      );  
    }
    return rs;
  };

  return (
    <>
      <div className="transaction-list">
        { getListDateGroup() }
      </div>  
    </>
  );
};