/* eslint-disable max-len */ ;(function () { 'use strict' let isMenuOpen = false let isDocumentOpen = false const MobileMenuToggle = document.querySelector('.nav-mobile-menu-toggle') const documentToggle = document.getElementById('document-toggle') const documentIcon = document.getElementById('document-icon') const menuIconDefault = ` <svg stroke="currentColor" fill="#0072ce" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"> <path fill="none" d="M0 0h24v24H0z"></path> <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path> </svg> ` const menuIconClose = ` <svg stroke="currentColor" fill="#0072ce" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"> <path fill="none" d="M0 0h24v24H0V0z"></path> <path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"></path> </svg> ` // 메뉴 토글 기능 MobileMenuToggle.addEventListener('click', function () { isMenuOpen = !isMenuOpen const menuList = document.querySelector('.navbar-mobile-menu') menuList.classList.toggle('show') if (isMenuOpen) { MobileMenuToggle.innerHTML = menuIconClose } else { MobileMenuToggle.innerHTML = menuIconDefault } }) // Document 토글 기능 documentToggle.addEventListener('click', function () { isDocumentOpen = !isDocumentOpen const documentList = document.querySelector('.mobile-product-link') documentList.classList.toggle('show') const pathElement = documentIcon.querySelector('path') if (isDocumentOpen) { pathElement.setAttribute('d', 'M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z') } else { pathElement.setAttribute('d', 'M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z') } }) })()