-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: update navigation #290
Conversation
size-limit report 📦
|
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.
packages/cxl-lumo-styles/scss/themes/vaadin-context-menu-item.scss
Outdated
Show resolved
Hide resolved
packages/cxl-lumo-styles/scss/themes/vaadin-context-menu-list-box.scss
Outdated
Show resolved
Hide resolved
packages/cxl-lumo-styles/scss/themes/vaadin-context-menu-list-box.scss
Outdated
Show resolved
Hide resolved
packages/cxl-lumo-styles/scss/themes/vaadin-context-menu-list-box.scss
Outdated
Show resolved
Hide resolved
c842a00
to
0418937
Compare
@HenerHoop can I do in-deep review comparing to the design or you'll push some changes soon? |
@pawelkmpt I'll push some changes soon. |
0418937
to
3ab4e04
Compare
3ab4e04
to
5463dca
Compare
5463dca
to
1118e4e
Compare
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.
@HenerHoop menu disappears during navigation. Take a look: https://www.loom.com/share/b58641f372be428189780c00bd227894?sid=a9793a0c-b72c-4568-bffb-0196c0120306
1118e4e
to
8777591
Compare
@pawelkmpt I accidentally pushed a few extra lines as well. You can now take another look. |
it's better 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.
It is working nice now, good job |
8777591
to
ca656b3
Compare
On mobile hovering on the item with descendants opens submenu. It doesn't work like that in other places. Need fixes |
3511a3a
to
1895ada
Compare
/* | ||
* Setup listeners on nav items to handle overlays events. | ||
*/ | ||
_setupSlottedMenuItems () { |
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.
// Second shadow set to emulate border | ||
box-shadow: 0 8px 24px 0 rgba(0, 0, 0, 0.25), 0 0 1px 1px #D2D5DA; | ||
opacity: 1; | ||
transition: opacity 0.2s, left 0.1s; |
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.
animations are not meant for aesthetics. They help hide an ugly flickering that happens because the menu is initally appended to the body and needs to be moved to the overlays-wrapper.
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.
@freudFlintstone I tested it on WPS and z-index issue occurs
2a60426
to
bede9e7
Compare
0c4031d
to
279ebfe
Compare
@@ -318,7 +362,11 @@ export class CXLMarketingNavElement extends LitElement { | |||
|
|||
menuItem.appendChild(link); | |||
|
|||
// If item is at depth 1 and had no children, assume it's a section header, do not show description | |||
if (item.sectionHeader && !item.children) { |
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.
@freudFlintstone I need this to be lowercase item.sectionheader
because tree JSON serializer we use in the PHP layer turns all keys into lowercase, I can't force it to camelCase
and therefore section headers do not have background.
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.
Also it should not be limited to a
component. I think section headers won't be of type component => a
.
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.
About the component, I'm not 100% sure why it's implemented like that, but I tested a couple ideas and the it needs that to render the items correctly. I can look into it a little deeper tomorrow.
But the <a>
tag is created by cxl-marketing-nav
and used in the menu list as a wrapper, so you are not obligated to pass only <a>
components from your side. As long as it's valid HTML or plain text, it will be properly rendered.
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.
About the component, I'm not 100% sure why it's implemented like that, but I tested a couple ideas and the it needs that to render the items correctly. I can look into it a little deeper tomorrow.
I do not agree. I just experimented and adding following code before if (item.component === 'a')
will do what I want:
- add section header item,
- no link, just item.
if (item.sectionheader) {
const menuItem = document.createElement('vaadin-context-menu-item');
menuItem.classList.add('section-header');
}
Is there anything wrong with adding context menu item without <a>
inside @freudFlintstone @anoblet ?
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.
But the tag is created by cxl-marketing-nav and used in the menu list as a wrapper, so you are not obligated to pass only components from your side. As long as it's valid HTML or plain text, it will be properly rendered.
At PHP level there's a condition which defines the component. Later in JS actual HTML element is created but as you can notice - there are conditions like:
if (item.component === 'a')
if (item.component === 'back')
.
Maybe instead of working with sectionheader
property we should define new component type?
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 fine with your solution for sectionheader, the difference in styling is too minimal to justify a different component just for that.
For the <a>
tag, no, it seems nothing that makes that mandatory, it was just a choice made years ago. It seems to be there just for creating links for items that have href
, but it's use as the default for other items too, unless they are set to hr
or back
.
Again, if checking for sectionheader before works, great, but we are probably still gonna need the <a>
when href is set.
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.
@pawelkmpt rolling back these changes, since Hesh told us we will need to support links in the future
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.
279ebfe
to
41b7ab1
Compare
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.
46819eb
to
274d527
Compare
@freudFlintstone let me show on examples what I mean by possibility to have menu section header WITHOUT a link/being CASE 1Following params passed. URL is empty string. $menu_item['component'] = 'a';
$menu_item['description'] = $item->description;
$menu_item['href'] = $item->url;
$menu_item['sectionheader'] = true; Result: Deep skills links to the current URL -> ❌ wrong CASE 2Following params passed. No $menu_item['component'] = 'a';
$menu_item['description'] = $item->description;
$menu_item['sectionheader'] = true; Result: Deep skills link is CASE 3Following params passed. It's section header and component not defined. $menu_item['description'] = $item->description;
$menu_item['sectionheader'] = true; Result: Deep skills has not background and no description -> ❌ wrong What I expect from section header item:
Please provide such tweak and tell me what params I shall pass to JS in order to make it work. |
…l positioning when logged in to wp
7c57ef9
to
b311beb
Compare
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.
Thank you for the detailed review @pawelkmpt , it really helped. This commit fixes it, but does not allow links to be used for section-header, for now. It does not have a hover state either, so users don't mistake it for a link.
The vertical positioning now works when logged to WP. There's a toggle in the component's story to test it.
Could not find a way to change the box shadow on vaadin-context-menu-list-box elements
https://app.clickup.com/t/861mx0nwm
https://www.figma.com/file/RTj2PtUSrCOUFtljOiq0W3/Dashboard?type=design&node-id=291-78069&mode=design