diff options
| Commit | b731b4a319e5e9e3f7f1263d43bf9c157c90d23f (patch) | |
|---|---|---|
| Author | 2020-07-13 17:49:49 +0300 | |
| Committer | 2020-07-13 17:49:49 +0300 | |
| Files | 2fe7a7332e26b5dd08af2f8fb7f829e50b4f6473 /wp-content/themes/carmag/assets/src | |
| tues-interns-2020-feature/header.tar tues-interns-2020-feature/header.tar.gz tues-interns-2020-feature/header.zip | ||
| Parent | 13e4865311b884fe6050bf6187ff2124c5c74ff0 (diff) | |
[Update] Added 'profile' menu when the user is logged in feature/header
2 files changed, 128 insertions, 5 deletions
| -rw-r--r-- | wp-content/themes/carmag/assets/src/sass/layout/_header.scss | 127 | ||||
| -rw-r--r-- | wp-content/themes/carmag/assets/src/scripts/scripts.js | 6 |
diff --git a/wp-content/themes/carmag/assets/src/sass/layout/_header.scss b/wp-content/themes/carmag/assets/src/sass/layout/_header.scss index 3f814ae..3802c2f 100644 --- a/wp-content/themes/carmag/assets/src/sass/layout/_header.scss +++ b/wp-content/themes/carmag/assets/src/sass/layout/_header.scss @@ -78,7 +78,7 @@ } } - .menu-primary-container { + .menu-container { transition: 0.2s; &.opened { @@ -88,7 +88,7 @@ pointer-events: auto; } - .menu-primary-menu-container { + div[class$="-menu-container"] { .menu { display: flex; flex-direction: row; @@ -104,6 +104,7 @@ .menu-item { margin: 0 10px; + position: relative; &.register { padding: 0; @@ -117,6 +118,89 @@ } } + &.profile { + min-width: max-content; + user-select: none; + cursor: pointer; + } + + .sub-menu { + display: flex; + flex-direction: column; + position: absolute; + background-color: $color-white; + right: 0; + visibility: hidden; + opacity: 0; + transition: 0.2s; + + li { + margin: 0; + border-top: 0.5px solid + rgba(0, 0, 0, 0.5); + border-bottom: 0.5px solid + rgba(0, 0, 0, 0.5); + + &:first-child { + border-top: none; + } + + &:last-child { + border-bottom: none; + } + + a { + color: black; + font-weight: normal; + text-shadow: 0 0 0.5px black; + transition: 0.2s; + + &:hover { + text-shadow: 0 0 1px black, + 0 0 1px black; //bolder + } + + &:before { + font-family: "Font Awesome 5 Pro"; + font-size: 25px; + margin: 0 10px 0 0; + vertical-align: sub; + } + } + + &.profile-edit { + a:before { + content: "\f4ff"; + } + } + + &.profile-publish { + a:before { + content: "\f055"; + } + } + + &.profile-logout { + a:before { + content: "\f2f5"; + } + } + } + } + + &.is-extended { + .sub-menu { + visibility: visible; + opacity: 1; + } + + .dropdown-arrow { + i { + transform: rotate(-90deg); + } + } + } + a { display: inline-block; transition: 0.2s; @@ -130,6 +214,16 @@ border-bottom: 1px solid white; } } + + .dropdown-arrow { + color: white; + display: inline-block; + + i { + transition: 0.2s; + transform: rotate(90deg); + } + } } } } @@ -156,7 +250,7 @@ display: flex; } - .menu-primary-container { + .menu-container { position: absolute; z-index: 1; visibility: hidden; @@ -167,7 +261,7 @@ left: 0; right: 0; - .menu-primary-menu-container { + div[class$="-menu-container"] { .menu { flex-direction: column; padding: 0 20px; @@ -194,6 +288,31 @@ width: 100%; border: 0; } + + &.profile { + & > a { + &:hover { + border-bottom: 1px solid + transparent; + } + + &:after { + font-family: "Font Awesome 5 Pro"; + content: "\f078"; + margin-left: 20px; + vertical-align: text-top; + } + } + } + + .sub-menu { + left: 0; + right: 0; + } + + .dropdown-arrow { + display: none; + } } } } diff --git a/wp-content/themes/carmag/assets/src/scripts/scripts.js b/wp-content/themes/carmag/assets/src/scripts/scripts.js index 93438c7..6394e2b 100644 --- a/wp-content/themes/carmag/assets/src/scripts/scripts.js +++ b/wp-content/themes/carmag/assets/src/scripts/scripts.js @@ -22,7 +22,7 @@ jQuery(document).ready(function ($) { const toggleDrawer = () => { const drawerClassList = event.target.classList; - const navClassList = document.querySelectorAll(".menu-primary-container")[0] + const navClassList = document.querySelectorAll(".menu-container")[0] .classList; drawerClassList.toggle("opened"); navClassList.toggle("opened"); @@ -31,9 +31,13 @@ const toggleDrawer = () => { const separator = document.createElement("span"); separator.className = "separator"; const loginLink = document.querySelectorAll(".login")[0]; +const profileDropdown = document.querySelectorAll(".profile")[0]; if (loginLink) { loginLink.before(separator); } +if (profileDropdown) { + profileDropdown.before(separator); +} const faqFields = document.querySelectorAll(".faq-field"); faqFields.forEach((field) => { |
