
import BookSection from "./js/main/index.js";
import ButtonScroll from './js/scroll/index.js';

const input = document.getElementById("search");
const books = document.getElementById("books");
const content = document.getElementById("content");
const booksSection = new BookSection({
  url: "../api/books/search",
  label: "books",
});
const click = () => {
  const query = document.getElementById("search").value;
  if (query) {
    booksSection.update({ query });
  }
};

searchButton.addEventListener("click", click);

input.addEventListener("keypress", function (event) {
  if (event.key === "Enter") {
    click();
  }
});
books.append(booksSection.element);

const scroll = new ButtonScroll()
content.append(scroll.element)