-
Notifications
You must be signed in to change notification settings - Fork 16
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-6279: Multilevel popup menu #897
Conversation
@@ -8,7 +8,7 @@ | |||
border-top-left-radius: $ibexa-border-radius; | |||
border-top-right-radius: $ibexa-border-radius; | |||
transition: all $ibexa-admin-transition-duration $ibexa-admin-transition, border-bottom-width 0; | |||
z-index: 2; | |||
z-index: 1050; |
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.
Note: restored after mistakenly deleted in: https://github.com/ibexa/admin-ui/pull/886/files#diff-4b3ad942bc4ac8d54e34e612e6b4708697317a9ae52700f12e676e2ebc1baa7b
} | ||
} | ||
} | ||
&--no-absolute { |
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.
Maybe instead of no-absolute -> initial-pos or static-pos
src/bundle/Resources/public/js/scripts/admin.multilevel.popup.menu.js
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
isOurBranch(branch) { |
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 Our
mean 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.
Whether this branch belongs to this menu.
|
||
&__split { | ||
display: none; | ||
width: calculateRem(0.5px); |
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.
Do we want to use half pixels? I think there were some problems between browsers/systems using it, but I'm not sure now
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.
AFAIR I've done this for the retina to look better and AFAIK we use half pixels.
Actually, it will be served to the browser in rem
where we use non-integer values all the time.
display: none; | ||
position: absolute; | ||
right: calculateRem(8px); | ||
top: calc(50% - calculateRem(16px) / 2); |
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 think that does not work and you have to use ${calculateRem(xxx)
inside calc
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.
it works
content: ''; | ||
border-top: calculateRem(1px) solid $ibexa-color-light; | ||
display: flex; | ||
width: calc(100% - calculateRem(16px)); |
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.
here as well
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.
it works
@@ -21,40 +25,109 @@ | |||
}, | |||
onAdapted: (visibleItems, hiddenItems) => { | |||
const hiddenButtonsIds = [...hiddenItems].map((item) => item.querySelector('.ibexa-btn').id); | |||
const topBranchItems = multilevelPopupMenu.getBranchItems(topBranch); |
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.
Is branch item like all of the items in current menu?
what is topBranchItems then? ParentItems of currentBranch?
Maybe parentBranchItems?
Or only like pinned items on top?
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 think I don't understand these questions, could you be more specific/precise? :)
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 just dont understand what is topBranch items :D
const relatedMainBtnId = mainBtn.id; | ||
const mainBtnLabel = mainBtn.querySelector('.ibexa-btn__label').textContent; | ||
const { | ||
alternativeMainBtnLabel: mainBtnAlternativeLabel, |
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.
is it bc you are already using this name in scope?
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 wanted this name to be more consistent with names in the upper scope.
@@ -0,0 +1,385 @@ | |||
(function (global, doc, ibexa, Popper) { | |||
class MultilevelPopupMenu { | |||
constructor(config) { |
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 about destructuring config?
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.
We tend to not destructure config
s in our codebase so that it is more clear in the constructor which thing comes from it.
return newBranchElement; | ||
} | ||
|
||
// eslint-disable-next-line no-unused-vars |
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.
can u explain why we need this here?
Cannot we just pass instead of arguments data and this variable?
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.
arguments
is better in a case e.g. this class is overwritten.
|
||
branchElement.classList.toggle('ibexa-popup-menu--hidden', !shouldBeExpanded); | ||
|
||
if (branchElement === topBranch) { |
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.
it should work
b9de87f
to
040945a
Compare
), | ||
]; | ||
const popupMenuElement = adaptedItemsContainer.querySelector('.ibexa-context-menu__item--more .ibexa-multilevel-popup-menu'); | ||
const showPopupButton = adaptedItemsContainer.querySelector('.ibexa-btn--more'); |
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.
Sometimes you use btn
(relatedBtn
) and sometimes button
(showPopupButton
) in your variable names, I think it would be good to stick to one version
alternativeToggleLabel, | ||
} = menuButton.dataset; | ||
const subitemsBtns = [...splitBtn.branchElement.querySelectorAll('.ibexa-popup-menu__item-content')]; | ||
|
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.
} | ||
} | ||
|
||
.ibexa-main-menu-popup &__group-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.
Why not
.ibexa-main-menu-popup &__group-name { | |
&__group-name { |
or
.ibexa-main-menu-popup &__group-name { | |
& &__group-name { |
040945a
to
b23ad56
Compare
Co-authored-by: Marek Nocoń <[email protected]>
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
MultilevelPopupMenu
This is a new component which is context-like menu.
twig example
Result
Code
JS
TODO
Checklist:
$ composer fix-cs
)