Skip to content

Commit

Permalink
Fix alignment issues, improve profile menu perf (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielBrierton authored Aug 23, 2016
1 parent d48bc51 commit 9aba114
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
40 changes: 17 additions & 23 deletions cd-menu/cd-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,31 +151,25 @@ window.cdMenu = function (options) {
each(profileLinks, function (profileLink) {
profileLink.href = zenBase + '/profile/' + userData.user.id;
});
request(zenBase + '/api/2.0/profiles/user-profile-data', JSON.stringify({
query: {
userId: userData.user.id
}
}), function (profile) {
each(profilePics, function (profilePic) {
profilePic.src = zenBase + '/api/2.0/profiles/' + profile.id + '/avatar_img';
});
if (userData.user.roles.indexOf('cdf-admin') !== -1) {
each(cdfAdminMenuLinks, function (menuLink) {
menuLink.style.display = 'block';
// TODO fix mobile nav to use classes so this isnt needed
menuLink.setAttribute('style', 'display: block !important;');
});
}
each(profiles, function (profile) {
profile.style.display = 'block';
each(profilePics, function (profilePic) {
profilePic.src = zenBase + '/api/2.0/profiles/' + userData.user.profileId + '/avatar_img';
});
if (userData.user.roles.indexOf('cdf-admin') !== -1) {
each(cdfAdminMenuLinks, function (menuLink) {
menuLink.style.display = 'block';
// TODO fix mobile nav to use classes so this isnt needed
menuLink.setAttribute('style', 'display: block !important;');
});
each(refererLinks, function (link) {
link.addEventListener('click', function (e) {
e.preventDefault();
window.location.href = this.href + '?referer=' + encodeURIComponent(window.location);
});
}
each(profiles, function (profile) {
profile.style.display = 'flex';
});
each(refererLinks, function (link) {
link.addEventListener('click', function (e) {
e.preventDefault();
window.location.href = this.href + '?referer=' + encodeURIComponent(window.location);
});
}, showLoginRegister);
});
} else {
showLoginRegister();
}
Expand Down
8 changes: 5 additions & 3 deletions cd-menu/cd-menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
display: none;
text-decoration: none;
cursor: pointer;
align-items: center;

&-pic {
border-radius: 100%;
Expand All @@ -25,6 +26,7 @@
text-decoration: none;
margin-left: 6px;
font-weight: 400;
flex: 1;
}

&-menu {
Expand Down Expand Up @@ -362,7 +364,7 @@
text-align: center;
font-size: 22px;
font-weight: 400;
background: @cd-white;
background: @cd-alt-white;
margin: 0;
padding: 12px;

Expand Down Expand Up @@ -455,7 +457,6 @@
background: @cd-alt-white;

> li {
padding: 0 10px;
flex: 1;
position: relative;

Expand All @@ -465,7 +466,7 @@
color: @cd-black;
text-decoration: none;
text-transform: uppercase;
padding: 15px 0;
padding: 15px 10px;
font-size: 14px;
font-weight: 400;
position: relative;
Expand Down Expand Up @@ -508,6 +509,7 @@
transition: background-color 0.2s ease-out;
padding: 15px 16px 15px 15px;
margin: -15px 0 -15px 0;
min-width: 240px;

&-dropdown {
outline-width: 0;
Expand Down
Loading

0 comments on commit 9aba114

Please sign in to comment.