Skip to content

Commit

Permalink
Add name initials to the logout button
Browse files Browse the repository at this point in the history
  • Loading branch information
cs1m0n committed Oct 2, 2024
1 parent e9cf70a commit 6e1761c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
12 changes: 12 additions & 0 deletions src/Experience/Components/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,20 @@ export default class Menu {

if (loginBtn) {
loginBtn.disabled = instance.logInLogOut.login
}

if (logoutBtn) {
logoutBtn.disabled = instance.logInLogOut.logout
}

if (instance.logInLogOut.logout === false) {
const nameInitials =
instance.experience.auth0.userData.given_name.substr(0, 1) +
instance.experience.auth0.userData.family_name.substr(0, 1)

// Set user's name initials
logoutBtn.querySelector('.name-initials').textContent = nameInitials
}
}

login = async () => {
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
<div class="edge left"></div>
<div class="content">
<svg class="icon"><use href="#user-solid" fill="currentColor"></use></svg>
<span class="name-initials"></span>
</div>
<div class="edge right"></div>
<div class="corner bottom-left"></div>
Expand Down
11 changes: 0 additions & 11 deletions src/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,6 @@ body.not-logged-in {
font-size: calc(var(--font-size-button) * 1.25);
}

#logout-button::after {
content: '';
position: absolute;
width: 14%;
height: 14%;
border-radius: 99px;
right: 20%;
top: 20%;
background-color: greenyellow;
}

/* #endregion */

// #region GUI
Expand Down

0 comments on commit 6e1761c

Please sign in to comment.