Skip to content
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

Merged
merged 7 commits into from
Aug 30, 2023
Merged

Conversation

HenerHoop
Copy link

@HenerHoop HenerHoop commented Jul 5, 2023

@github-actions
Copy link

github-actions bot commented Jul 5, 2023

size-limit report 📦

Path Size
packages/cxl-ui/pkg/dist-web/cxl-ui.js 34.03 KB (+0.27% 🔺)
packages/cxl-ui/pkg/dist-web/cxl-ui-jwplayer.js 11.87 KB (0%)
packages/cxl-ui/pkg/dist-web/cxl-ui-playbooks.js 25.39 KB (+0.41% 🔺)
packages/cxl-ui/pkg/dist-web/vendor.js 125.6 KB (0%)
packages/cxl-ui/pkg/dist-web/cxl-ui-jwplayer.js, packages/cxl-ui/pkg/dist-web/cxl-ui-playbooks.js, packages/cxl-ui/pkg/dist-web/cxl-ui.js, packages/cxl-ui/pkg/dist-web/manifest.js, packages/cxl-ui/pkg/dist-web/unresolved.js, packages/cxl-ui/pkg/dist-web/vendor.js 198.04 KB (+0.1% 🔺)

Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far but some work still to be done. Keep going :)

Also take into account such situation:
Screenshot 2023-07-06 at 09 26 25

@pawelkmpt pawelkmpt requested a review from heshfekry July 6, 2023 07:38
@pawelkmpt pawelkmpt changed the base branch from master to feat/navigation July 6, 2023 08:06
@HenerHoop HenerHoop force-pushed the hener/feat/navigation-update branch from c842a00 to 0418937 Compare July 6, 2023 15:46
@pawelkmpt
Copy link

@HenerHoop can I do in-deep review comparing to the design or you'll push some changes soon?

@HenerHoop
Copy link
Author

@pawelkmpt I'll push some changes soon.

@HenerHoop HenerHoop force-pushed the hener/feat/navigation-update branch from 0418937 to 3ab4e04 Compare July 7, 2023 14:11
@HenerHoop HenerHoop requested a review from pawelkmpt July 7, 2023 14:12
@HenerHoop HenerHoop force-pushed the hener/feat/navigation-update branch from 3ab4e04 to 5463dca Compare July 8, 2023 15:09
@HenerHoop HenerHoop force-pushed the hener/feat/navigation-update branch from 5463dca to 1118e4e Compare July 9, 2023 12:50
@pawelkmpt pawelkmpt assigned pawelkmpt and unassigned pawelkmpt Jul 10, 2023
Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HenerHoop HenerHoop force-pushed the hener/feat/navigation-update branch from 1118e4e to 8777591 Compare July 10, 2023 10:20
@HenerHoop
Copy link
Author

@pawelkmpt I accidentally pushed a few extra lines as well. You can now take another look.

@pawelkmpt
Copy link

@pawelkmpt I accidentally pushed a few extra lines as well. You can now take another look.

it's better now 👍

Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Paddings (left/right) are too big. I didn't measure them but at the first glance they're bigger than in the design.
Screenshot 2023-07-10 at 15 22 14
  1. Scroll for above pictured item doesn't work.

  2. Black bar items on the left should be gray

@pawelkmpt
Copy link

Could not find a way to change the box shadow on vaadin-context-menu-list-box elements

It is working nice now, good job

@pawelkmpt
Copy link

On mobile hovering on the item with descendants opens submenu. It doesn't work like that in other places. Need fixes

@freudFlintstone freudFlintstone force-pushed the hener/feat/navigation-update branch 2 times, most recently from 3511a3a to 1895ada Compare August 17, 2023 02:05
/*
* Setup listeners on nav items to handle overlays events.
*/
_setupSlottedMenuItems () {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the bug discussed here. Credit to @anoblet for finding the solution.

// 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;

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.

Copy link

@pawelkmpt pawelkmpt left a 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

Screenshot 2023-08-18 at 11 17 08

@freudFlintstone freudFlintstone force-pushed the hener/feat/navigation-update branch 2 times, most recently from 2a60426 to bede9e7 Compare August 18, 2023 21:13
@freudFlintstone freudFlintstone force-pushed the hener/feat/navigation-update branch 2 times, most recently from 0c4031d to 279ebfe Compare August 18, 2023 22:59
@@ -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) {

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.

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.

Copy link

@freudFlintstone freudFlintstone Aug 25, 2023

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.

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 ?

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?

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.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still a small issue with that section label, because the figma spec uses a font-weight of 400, which we don't include in the current font. It is using a bolder 600 for now.
image

Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradients mess up mobile view for menu

Screenshot 2023-08-25 at 15 09 37
Screenshot 2023-08-25 at 15 09 47
Screenshot 2023-08-25 at 15 09 51

@pawelkmpt
Copy link

pawelkmpt commented Aug 29, 2023

@freudFlintstone let me show on examples what I mean by possibility to have menu section header WITHOUT a link/being a component.

CASE 1

Following 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

Screenshot 2023-08-29 at 10 25 06


CASE 2

Following params passed. No href item.

$menu_item['component']     = 'a';
$menu_item['description']   = $item->description;
$menu_item['sectionheader'] = true;

Result: Deep skills link is undefined -> ❌ wrong

Screenshot 2023-08-29 at 10 24 44


CASE 3

Following 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

Screenshot 2023-08-29 at 10 31 00


What I expect from section header item:

  • background,
  • description,
  • link only when href is not empty.

Please provide such tweak and tell me what params I shall pass to JS in order to make it work.

@pawelkmpt
Copy link

Bug

Context menu items are positioned differently for logged in and guest users.
Possible reason: logged in users see admin bar at the top and JS doesn't take it into account.

✅ CORRECT for guests

Screenshot 2023-08-29 at 10 35 36

❌ INCORRECT for logged in users

Screenshot 2023-08-29 at 10 35 24

Copy link

@freudFlintstone freudFlintstone left a 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.

@pawelkmpt pawelkmpt merged commit 2302393 into feat/navigation Aug 30, 2023
4 checks passed
@pawelkmpt pawelkmpt deleted the hener/feat/navigation-update branch January 9, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants