import { Utils } from "./Utils";

export class UtilList {
  parent: HTMLElement;
  ul: HTMLElement;
  items: HTMLElement[];
  constructor(parent: HTMLElement, liTag="li") {
    this.parent = parent;
    this.ul = Utils.ul();
    this.items = [];
    this.configure();
  }
  configure() {
    this.parent.appendChild(this.ul);
  }

  addListItem(spaceBetween = false) {
    const li = Utils.listItem();
    this.items.push(li);
    this.ul.appendChild(li);
    if (spaceBetween) {
      li.classList.add("d-flex", "justify-content-between");
    }
    return li;
  }

}
