// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.

// Write your JavaScript code.
document.getElementById("fSearch").addEventListener("submit", function (e) {
    e.preventDefault();
    let keyword = this.keyword.value.trim();

    if (keyword === "") {
        alert("검색어를 입력해주세요.");
        return false;
    };

    this.submit();
});

const btnMenuToggle = document.getElementById('btnMenuToggle');
const asideArea = document.getElementsByTagName('aside');
const overlay = document.getElementById('overlay');

btnMenuToggle.addEventListener('click', () => {
    let aside = asideArea[0].style;
    if (aside.transform === 'translateX(0px)') {
        aside.transform = 'translateX(-100%)';
        overlay.classList.remove('show');
    } else {
        aside.transform = 'translateX(0)';
        overlay.classList.toggle('show');
    }
});

const btnCancel = document.getElementById('btnCancel');

btnCancel.addEventListener('click', () => {
    let aside = asideArea[0].style;
    aside.transform = 'translateX(-100%)';
    overlay.classList.remove('show');
});