diff --git a/src/js/theme-switcher.js b/src/js/theme-switcher.js index 46fcf5b86eeeb59964db7417e3d94f5c85b94fc4..314dcbee7bb83262434247c9968134b5e877192b 100644 --- a/src/js/theme-switcher.js +++ b/src/js/theme-switcher.js @@ -4,6 +4,9 @@ const body = document.querySelector('body'); const footer = document.querySelector('footer'); const footerText = document.querySelector('.footer_text'); const filmInfo = document.querySelector('.film-info__overlay'); +const switcher = document.querySelector('.switcher'); +const navLib = document.getElementById('library'); +const home = document.getElementById('home'); checkbox.addEventListener('change', onDarkTheme); @@ -12,4 +15,16 @@ function onDarkTheme() { footer.classList.toggle('dark'); footerText.classList.toggle('dark'); filmInfo.classList.toggle('dark-modal'); -} \ No newline at end of file +} + +navLib.addEventListener('click', () => { + if (navLib) { + switcher.classList.add('visually-hidden'); + } +}); + +home.addEventListener('click', () => { + if (home) { + switcher.classList.remove('visually-hidden'); + } +}); diff --git a/src/partials/header.html b/src/partials/header.html index 6063fa652c764b547aff48c4e06c55a9509298d4..053be8f037f1aa56b9f816bb1c66e64faf22dfb4 100644 --- a/src/partials/header.html +++ b/src/partials/header.html @@ -9,22 +9,15 @@ <p class="logo__text">Filmoteka</p> </div> <ul class="nav__list list"> - <li class="nav__item nav__item--current">Home</li> - <li class="nav__item">My library</li> + <li class="nav__item nav__item--current" id="home">Home</li> + <li class="nav__item" id="library">My library</li> </ul> </div> </nav> <div class="search-field" data-action="search-field"> <form class="search-field__form"> - <input - class="search-field__input" - placeholder="Поиск фильмов" - type="text" - name="search" - id="search" - autocomplete="off" - data-action="search-input" - /> + <input class="search-field__input" placeholder="Поиск фильмов" type="text" name="search" id="search" + autocomplete="off" data-action="search-input" /> <button class="search-field__btn" data-action="search-btn" type="submit"> <svg width="12px" height="12px" class="search-field__icon"> <use href="/images/sprite.svg#search"></use> @@ -50,4 +43,4 @@ </label> </div> </div> -</header> +</header> \ No newline at end of file diff --git a/src/sass/_header.scss b/src/sass/_header.scss index b6d8cd4862ac29188e1b66c217ffe32581721a82..fbf9cd0c6a9cf8c8afe27851b4ac233fb98b4f28 100644 --- a/src/sass/_header.scss +++ b/src/sass/_header.scss @@ -55,6 +55,18 @@ .logo__icon { justify-self: middle; + animation: scroll 3s infinite; +} +@keyframes scroll { + 0% { + transform: translateY(0); + } + 50% { + transform: translateY(-0.3rem); + } + 100% { + transform: translateY(0); + } } .logo__text { diff --git a/src/sass/_theme-switcher.scss b/src/sass/_theme-switcher.scss index c2139e74db88bb125bd30b8af7c8467490f477d3..2d2d1014c7bb38f92482d0054abfdde70f6a269e 100644 --- a/src/sass/_theme-switcher.scss +++ b/src/sass/_theme-switcher.scss @@ -1,62 +1,56 @@ .dark { - background-color: rgb(31, 33, 37); - color: #CDCDD2; + background-color: rgb(31, 33, 37); + color: #cdcdd2; - :link { - color: white; - - } + :link { + color: white; + } } - .label { - background-color: #555; - display: flex; - align-items: center; - justify-content: space-between; - position: relative; - padding: 5px; - border-radius: 50px; - width: 50px; - height: 26px; + background-color: #555; + display: flex; + align-items: center; + justify-content: space-between; + position: relative; + padding: 5px; + border-radius: 50px; + width: 50px; + height: 26px; } .switcher { - - - display: flex; - - flex-direction: row-reverse; - + @media screen and (max-width: 420px) { + display: none; + } + display: flex; + flex-direction: row-reverse; } .checkbox { - opacity: 0; - position: absolute; + opacity: 0; + position: absolute; } - - .ball { - width: 22px; - height: 22px; - background-color: #fff; - position: absolute; - top: 2px; - left: 2px; - border-radius: 50%; - transition: transform 0.2s linear; + width: 22px; + height: 22px; + background-color: #fff; + position: absolute; + top: 2px; + left: 2px; + border-radius: 50%; + transition: transform 0.2s linear; } -.checkbox:checked+.label .ball { - // background-color: #f39c12; - transform: translateX(24px); +.checkbox:checked + .label .ball { + transform: translateX(24px); } .fa-moon { - color: #f1c40f; + color: #f1c40f; } .fa-sun { - color: #f39c12; -} \ No newline at end of file + color: #f39c12; +}