-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-650: redesign menu #1808
IBX-650: redesign menu #1808
Conversation
e41465f
to
4676046
Compare
786e29e
to
f6590a7
Compare
return; | ||
} | ||
|
||
allPopups.push( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not using those popups. Why do you keep them in array?
614a08b
to
b67a08c
Compare
const extraClasses = tooltipNode.dataset.extraClasses || ''; | ||
const placement = tooltipNode.dataset.placement || 'bottom'; | ||
const extraClass = tooltipNode.dataset.tooltipExtraClass || ''; | ||
const placement = tooltipNode.dataset.tooltipPlacement || 'bottom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const placement = tooltipNode.dataset.tooltipPlacement || 'bottom'; | |
const placement = tooltipNode.dataset.tooltipPlacement ?? 'bottom'; |
@@ -36,8 +36,8 @@ | |||
show: tooltipNode.dataset.delayShow || 150, | |||
hide: tooltipNode.dataset.delayHide || 75, | |||
}; | |||
const extraClasses = tooltipNode.dataset.extraClasses || ''; | |||
const placement = tooltipNode.dataset.placement || 'bottom'; | |||
const extraClass = tooltipNode.dataset.tooltipExtraClass || ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const extraClass = tooltipNode.dataset.tooltipExtraClass || ''; | |
const extraClass = tooltipNode.dataset.tooltipExtraClass ?? ''; |
@@ -0,0 +1,132 @@ | |||
(function(global, doc, localStorage, eZ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(function(global, doc, localStorage, eZ) { | |
(function(global, doc, eZ, localStorage) { |
nitpicking, but so far eZ
(if it was used) was always third argument
let resizeStartPositionX = 0; | ||
let secondMenuLevelCurrentWidth = secondLevelMenuNode.getBoundingClientRect().width; | ||
const showSecondLevelMenu = (event) => { | ||
const { toggle } = event.currentTarget.dataset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho there's no need to put it into new variable if you use it only in one place (in if, in this case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you can remove it now ;)
<div class="ibexa-main-header"> | ||
<div class="ibexa-main-header__brand-column"> | ||
<a class="ibexa-main-header__brand" href="{{ url('ezplatform.dashboard') }}"> | ||
<img class="ibexa-main-header__brand-image" src="/bundles/ezplatformadminui/img/ibexa-logo.svg" alt="Ibexa" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm... translation? :D
Also, I'm not sure, don't we have some func for resources path?
{% set current_item = item %} | ||
|
||
{% for item in current_item.children %} | ||
{% if matcher.isCurrent(item) and item.children|length == 0%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% if matcher.isCurrent(item) and item.children|length == 0%} | |
{% if matcher.isCurrent(item) and item.children|length == 0 %} |
{{ block('linkElement') }} | ||
{% endblock %} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
{%- endif -%} | ||
|
||
{%- if item.extras.template is defined -%} | ||
{% include(item.extras.template) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% include(item.extras.template) %} | |
{% include(item.extras.template) %} |
9a99a87
to
999f8a9
Compare
let resizeStartPositionX = 0; | ||
let secondMenuLevelCurrentWidth = secondLevelMenuNode.getBoundingClientRect().width; | ||
const showSecondLevelMenu = (event) => { | ||
const { toggle } = event.currentTarget.dataset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you can remove it now ;)
const triggerElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name'); | ||
const popupMenuElement = userMenuContainer.querySelector('.ibexa-popup-menu'); | ||
const popupMenu = new eZ.core.PopupMenu({ | ||
triggerElement, | ||
popupMenuElement, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const triggerElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name'); | |
const popupMenuElement = userMenuContainer.querySelector('.ibexa-popup-menu'); | |
const popupMenu = new eZ.core.PopupMenu({ | |
triggerElement, | |
popupMenuElement, | |
const usernameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name'); | |
const popupMenuElement = userMenuContainer.querySelector('.ibexa-popup-menu'); | |
const popupMenu = new eZ.core.PopupMenu({ | |
triggerElement: usernameElement, | |
popupMenuElement, |
} | ||
|
||
const triggerElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does name
from CSS selector refer to? Is it a username?
@@ -0,0 +1,8 @@ | |||
@mixin hidden-main-menu-node { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether we really need this as a global mixin, it can be local to .ibexa-main-menu
as it is used only there. What do you think?
if (!localStorage.getItem('secondLevelMenuWidth') || secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden')) { | ||
return; | ||
} | ||
|
||
const { secondLevelMenuWidth } = localStorage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!localStorage.getItem('secondLevelMenuWidth') || secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden')) { | |
return; | |
} | |
const { secondLevelMenuWidth } = localStorage; | |
const savedSecondLevelMenuWidth = localStorage.getItem('secondLevelMenuWidth'); | |
const isSecondLevelMenuHidden = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden'); | |
if (!savedSecondLevelMenuWidth || isSecondLevelMenuHidden) { | |
return; | |
} |
const newMenuWidth = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed') | ||
? SECOND_LEVEL_EXPANDED_WIDTH | ||
: SECOND_LEVEL_COLLAPSED_WIDTH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const newMenuWidth = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed') | |
? SECOND_LEVEL_EXPANDED_WIDTH | |
: SECOND_LEVEL_COLLAPSED_WIDTH; | |
const isSecondLevelMenuCollapsed = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed'); | |
const newMenuWidth = isSecondLevelMenuCollapsed ? SECOND_LEVEL_EXPANDED_WIDTH : SECOND_LEVEL_COLLAPSED_WIDTH; |
setWidthOfSecondLevelMenu(); | ||
}; | ||
const fitMenu = () => { | ||
const diff = Math.max(HEADER_HEIGHT - global.scrollY, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO name of this variable is too generic.
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.top = `${diff}px`; | ||
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.height = `${global.innerHeight - diff}px`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.top = `${diff}px`; | |
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.height = `${global.innerHeight - diff}px`; | |
const firstLevelMenuItemsList = firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list'); | |
firstLevelMenuItemsList.style.top = `${diff}px`; | |
firstLevelMenuItemsList.style.height = `${global.innerHeight - diff}px`; |
|
||
&:hover { | ||
cursor: pointer; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Element is clickable all the time, not only on hover.
&:hover { | |
cursor: pointer; | |
} | |
cursor: pointer; |
} | ||
|
||
const usernameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const usernameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name'); | |
const userNameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name'); |
6b58589
to
706d487
Compare
Rebase is required here. Can this be merged once Dashboard is in? |
@lserwatka this one requires some changes in Behat tests that I'd like to do before it's merged, I will be working on it soon |
@mnocon alright, thank you for clarification 👍 |
d9cc2a2
to
32d468b
Compare
7e45537
to
f889b19
Compare
0a6ffc4
to
72ae216
Compare
Kudos, SonarCloud Quality Gate passed!
|
New look:
![Screenshot from 2021-07-19 12-44-16](https://user-images.githubusercontent.com/24355391/126148480-1f277bce-bf58-4122-8275-63bbab05123e.png)
![Screenshot from 2021-07-19 12-44-09](https://user-images.githubusercontent.com/24355391/126148483-10dfb3be-a3d4-429e-a8f0-f18b21f46380.png)
![Screenshot from 2021-07-19 12-43-57](https://user-images.githubusercontent.com/24355391/126148484-55a09446-bad3-41c3-bbcb-32b473016aa1.png)
Checklist:
$ composer fix-cs
)