From 634607d236742d6fe5e6300b80b455c9a772995c Mon Sep 17 00:00:00 2001 From: Sergey Yarkov Date: Fri, 26 Aug 2022 18:34:18 +0300 Subject: [PATCH] refactored css for header --- src/components/BaseLayout/BaseLayout.astro | 2 +- src/components/Header/Header.astro | 136 ++++++++++++++++- src/components/Header/Header.scss | 144 ------------------ .../Header/NavToggle/NavToggle.scss | 7 + .../HeaderBanner/HeaderBanner.astro | 24 +-- .../LanguageSelect/LanguageSelect.astro | 17 ++- .../ThemeSwticher/ThemeSwitcher.scss | 13 ++ .../ThemeSwticher/ThemeSwitcher.tsx | 8 +- 8 files changed, 175 insertions(+), 176 deletions(-) delete mode 100644 src/components/Header/Header.scss diff --git a/src/components/BaseLayout/BaseLayout.astro b/src/components/BaseLayout/BaseLayout.astro index 8e18df1..1a29efd 100644 --- a/src/components/BaseLayout/BaseLayout.astro +++ b/src/components/BaseLayout/BaseLayout.astro @@ -7,7 +7,7 @@ import HeaderBanner from "@components/HeaderBanner"; import UIString from "@components/UIString"; --- - + { IS_SITE_UNDER_CONSTRUCTION && ( diff --git a/src/components/Header/Header.astro b/src/components/Header/Header.astro index ef6af4c..cd24d2c 100644 --- a/src/components/Header/Header.astro +++ b/src/components/Header/Header.astro @@ -7,21 +7,20 @@ import UIString from "@components/UIString"; import TranslatedLink from "@components/TranslatedLink"; import LanguageSelect from "@components/LanguageSelect"; import NavToggle from "./NavToggle"; -import "./Header.scss"; const { name, nav, contacts } = SITE_METADATA; const { pathname } = Astro.url; --- -
+
-
+ + diff --git a/src/components/Header/Header.scss b/src/components/Header/Header.scss deleted file mode 100644 index 0378aef..0000000 --- a/src/components/Header/Header.scss +++ /dev/null @@ -1,144 +0,0 @@ -.header { - position: sticky; - top: 0; - border-bottom: 1px solid var(--border-color); - background-color: var(--background-header-color); - padding-top: 13.5px; - padding-bottom: 13.5px; - user-select: none; - z-index: 9999; - & .container { - display: flex; - align-items: center; - justify-content: space-between; - } - - &__logo a { - text-decoration: none; - font-weight: 600; - font-size: var(--font-size-lg); - color: var(--font-color); - &:hover { - text-decoration: underline; - text-decoration-thickness: 2px; - text-underline-offset: 5px; - } - } - &__nav { - display: flex; - align-items: center; - & ul { - display: flex; - list-style: none; - column-gap: 20px; - margin: 0; - padding: 0; - margin-right: 35px; - & li a { - display: inline-block; - font-weight: 500; - color: var(--font-color); - text-decoration: none; - text-transform: lowercase; - &:hover, - &.active { - color: var(--color-blue-500); - text-decoration: underline; - text-decoration-thickness: 2px; - text-underline-offset: 4px; - } - } - } - &-contacts { - display: flex; - align-items: center; - column-gap: 10px; - margin-right: 30px; - & a { - text-decoration: none; - font-size: 0; - &:hover { - opacity: var(--opacity-hover); - } - } - } - &-settings { - column-gap: 13.5px; - } - } -} - -@media screen and (max-width: 768px) { - .header { - padding: 10px 0; - &__nav { - display: none; - } - } - - body[data-is-mobile-open="true"] { - overflow-y: hidden; - touch-action: none; - & .header { - padding: 15px 0; - background-color: var(--background-header-color); - position: fixed; - right: 0; - left: 0; - top: 0; - bottom: 0; - height: 100%; - z-index: 9999; - & .container { - flex-direction: column; - row-gap: 3rem; - } - &__logo { - align-self: flex-start; - } - &__nav { - display: block; - &-links { - display: block; - text-align: center; - margin: 0; - & li { - margin-bottom: 30px; - & a { - font-size: var(--font-size-xl); - } - } - } - &-contacts { - margin-right: 0; - margin-top: 2rem; - justify-content: center; - } - } - & .nav-toggle { - position: absolute; - right: var(--content-padding); - } - & .theme-switcher { - display: block; - position: absolute; - bottom: 45px; - right: 2.2rem; - & svg { - width: 36px; - height: 36px; - } - } - & .language-select { - position: absolute; - bottom: 115px; - right: 2.2rem; - & svg, - & select { - height: 36px; - width: 36px; - } - } - } - } -} diff --git a/src/components/Header/NavToggle/NavToggle.scss b/src/components/Header/NavToggle/NavToggle.scss index 9db71a9..7abff1d 100644 --- a/src/components/Header/NavToggle/NavToggle.scss +++ b/src/components/Header/NavToggle/NavToggle.scss @@ -13,3 +13,10 @@ display: none; } } + +body[data-is-mobile-open="true"] { + .nav-toggle { + position: absolute; + right: var(--content-padding); + } +} diff --git a/src/components/HeaderBanner/HeaderBanner.astro b/src/components/HeaderBanner/HeaderBanner.astro index d3f7424..c286983 100644 --- a/src/components/HeaderBanner/HeaderBanner.astro +++ b/src/components/HeaderBanner/HeaderBanner.astro @@ -1,13 +1,9 @@ -