"use strict";

const btnHot = document.getElementById("btn__hot");
const btnSearch = document.getElementById("btn__search");
const btnCalendar = document.getElementById("btn__calendar");
const btnPlane = document.getElementById("plane");

const divHot = document.getElementById("hot");
const divSearch = document.getElementById("search");
const divCalendar = document.getElementById("calendar");
const blockName = document.querySelector(".header__blockname");

const imgHot = document.getElementById("img__hot");
const imgSearch = document.getElementById("img__search");
const imgCalendar = document.getElementById("img__calendar");

// setTimeout(
//   () => (document.querySelector(".TVBButtonCaption").textContent = "✈️"),
//   400
// );

btnHot.addEventListener("click", function (e) {
  e.preventDefault();

  divHot.classList.remove("hidden");
  divSearch.classList.add("hidden");
  divCalendar.classList.add("hidden");

  btnHot.classList.add("btn__active");
  btnSearch.classList.remove("btn__active");
  btnCalendar.classList.remove("btn__active");

  imgHot.src = "img/hot_active.svg";
  imgSearch.src = "img/search.svg";
  imgCalendar.src = "img/calendar.svg";

  blockName.textContent = "Горящие туры";
});

btnSearch.addEventListener("click", function () {
  divHot.classList.add("hidden");
  divSearch.classList.remove("hidden");
  divCalendar.classList.add("hidden");

  btnHot.classList.remove("btn__active");
  btnSearch.classList.add("btn__active");
  btnCalendar.classList.remove("btn__active");

  imgHot.src = "img/hot.svg";
  imgSearch.src = "img/search_active.svg";
  imgCalendar.src = "img/calendar.svg";

  blockName.textContent = "Поиск туров";
});

btnCalendar.addEventListener("click", function (e) {
  e.preventDefault();
  divHot.classList.add("hidden");
  divSearch.classList.add("hidden");
  divCalendar.classList.remove("hidden");

  btnHot.classList.remove("btn__active");
  btnSearch.classList.remove("btn__active");
  btnCalendar.classList.add("btn__active");

  imgHot.src = "img/hot.svg";
  imgSearch.src = "img/search.svg";
  imgCalendar.src = "img/calendar_active.svg";

  blockName.textContent = "Ближайшие туры";
});
