// Spaguette

let jsSearch = $('.menu-item:nth-child(1)').find('.menu-link').addClass('js-search');
let openMenu = $('.menu-item:nth-child(4)').find('.menu-link').addClass('js-link');
let openSearch = $('.banner-index__link');
let btnClose = $('.lightbox-close');

jsSearch.on('click', function() {
    $('.lightbox--search').addClass('lightbox--open');
    $('.lightbox--search').attr('aria-hidden', 'false');
});

openSearch.on('click', function() {
    $('.lightbox--search').addClass('lightbox--open');
    $('.lightbox--search').attr('aria-hidden', 'false');
});

openMenu.on('click', function() {
    $('.lightbox--nav').addClass('lightbox--open');
    $('.lightbox--nav').attr('aria-hidden', 'false');
});

btnClose.on('click', function(e) {
    e.preventDefault();

    $('.lightbox--nav').removeClass('lightbox--open');
    $('.lightbox--search').removeClass('lightbox--open');
});

// Object Literal Pattern
var modal = {

    cacheDOM: () => {
      this.jsSearch = document.querySelector('.menu-item:nth-child(1)').find('.menu-link').addClass('js-search');
      let openMenu = $('.menu-item:nth-child(4)').find('.menu-link').addClass('js-link');
      let openSearch = $('.banner-index__link');
      let btnClose = $('.lightbox-close');          
    },

    render: () => {

    }, 

    bindEvents: () => {
        this.$btnClose.close(this.close.bind());
    },

    show: () => {
        $('.lightbox--nav').addClass('lightbox--open');
        $('.lightbox--nav').attr('aria-hidden', 'false');
    },

    close: (e) => {
        e.preventDefault();

        $('.lightbox--nav').removeClass('lightbox--open');
        $('.lightbox--search').removeClass('lightbox--open');
    }
}