Skip to content

Commit

Permalink
Merge pull request #290 from conversionxl/hener/feat/navigation-update
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelkmpt authored Aug 30, 2023
2 parents 04c0329 + b311beb commit 2302393
Show file tree
Hide file tree
Showing 11 changed files with 541 additions and 158 deletions.
2 changes: 1 addition & 1 deletion packages/cxl-lumo-styles/scss/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ html {
0 #{$cxl-box-shadow-width} 0 0 #{$cxl-box-shadow-color} inset;

// cxl-marketing-nav height on desktop
--cxl-marketing-nav-height: 88px;
--cxl-marketing-nav-height: 76px;
}

// @see https://github.com/conversionxl/aybolit/blob/490e58e71f13c2e8a398959f91b938f9309b41f8/packages/cxl-ui/src/components/cxl-marketing-nav.js#L46
Expand Down
51 changes: 49 additions & 2 deletions packages/cxl-lumo-styles/scss/themes/vaadin-context-menu-item.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,57 @@
:host([theme~="cxl-marketing-nav"]:not(.has-description)) {
padding-top: 0;
padding-bottom: 0;
}

:host([theme~="cxl-marketing-nav"].section-header) {
color: var(--lumo-body-text-color);
background: var(--lumo-shade-10pct);
font-weight: 600;
text-transform: uppercase;

::slotted(.vaadin-context-menu-item--description) {
text-transform: none;
}
}

:host([theme~="cxl-marketing-nav"].has-description) {
[part="content"] ::slotted(.vaadin-context-menu-item--description) {
font-weight: 400;
}
}

:host([theme~="cxl-marketing-nav"]:not(.section-header):hover),
:host([theme~="cxl-marketing-nav"]:not(.section-header)[expanded]) {
color: var(--lumo-primary-color);

&::after {
color: var(--lumo-primary-color);
}
}

:host([theme~="cxl-marketing-nav"].vaadin-menu-item.vaadin-context-menu-parent-item)::after {
margin-right: 0;
font-size: var(--lumo-icon-size);
}

@media screen and (min-width: 750px) {
:host([theme~="cxl-marketing-nav"].vaadin-menu-item.back-button-menu-item) {
display: none;
}
}

:host([theme~="cxl-marketing-nav"]) [part='checkmark'][aria-hidden='true'] {
display: none;
}

::slotted(a) {
// Increase link click surface.
display: block;

color: inherit !important; /* stylelint-disable-line declaration-no-important */
text-decoration: none !important; /* stylelint-disable-line declaration-no-important */
}

::slotted(a:not(:hover)) {
text-decoration: none !important; /* stylelint-disable-line declaration-no-important */
::slotted(a:hover) {
color: var(--lumo-primary-color) !important; /* stylelint-disable-line declaration-no-important */
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,27 @@
box-shadow: inset 0 0 0 ($vaadin-focus-ring-thickness * 0.5) var(--lumo-primary-color);
}
}

:host([theme~="cxl-marketing-nav"].vaadin-menu-list-box) {
[part='items'] ::slotted(.vaadin-menu-item) {
padding-right: var(--lumo-space-m);
padding-left: var(--lumo-space-m);
}

[part="items"] ::slotted(.section-header.vaadin-menu-item:hover:not([disabled])) {
/* revert default vaadin-context-menu-list-box hovering style, without losing other styles styles applied */
background-color: revert-layer;
}
}

@media screen and (min-width: 783px) {
:host([theme~="cxl-marketing-nav"]) {
display: block;
width: var(--cxl-vaadin-context-menu-item-max-width);
padding: 0 var(--lumo-space-s);
}
}

:host([theme~="cxl-marketing-nav"]) [part='items'] ::slotted(.vaadin-menu-item) {
border-radius: 0;
}
39 changes: 35 additions & 4 deletions packages/cxl-lumo-styles/scss/themes/vaadin-overlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@

// Theme: cxl-course-dialog
:host([theme="cxl-course-dialog"]) {
[part='backdrop'] {
[part="backdrop"] {
background-color: var(--cxl-color-black-50pct);
}

[part='overlay'] {
[part="overlay"] {
width: 100%;
max-width: var(--cxl-content-max-width);
}

[part='content'] {
[part="content"] {
padding: var(--lumo-space-m) var(--lumo-space-m) 0 var(--lumo-space-m);

@media #{mq.$small} {
padding: var(--lumo-space-l) var(--lumo-space-l) 0 var(--lumo-space-l);
}
}

[part='footer'] {
[part="footer"] {
background-color: unset;
box-shadow: var(--lumo-box-shadow-m);

Expand All @@ -44,3 +44,34 @@
}
}
}

:host([theme~="cxl-marketing-nav"]) [part="content"] {
padding-left: 0;
padding-right: 0;
}

@media screen and (min-width: 750px) {
:host([theme~="cxl-marketing-nav"]) {
position: relative;
top: 0 !important; /* stylelint-disable-line declaration-no-important */
right: 0;
bottom: 0;
left: 0 !important; /* stylelint-disable-line declaration-no-important */
align-items: unset !important; /* stylelint-disable-line declaration-no-important */
justify-content: unset !important; /* stylelint-disable-line declaration-no-important */
width: 376px;
margin: 0;
overflow: auto;
visibility: hidden;
opacity: 0; // hide while in the body, to avoid flickering render, show after being moved to the overlays-wrapper element
transition: opacity 0.1s;
}

:host([theme~="cxl-marketing-nav"]) [part="content"] {
padding: 0;
}

:host([theme~="cxl-marketing-nav"]) [part="overlay"] {
box-shadow: none;
}
}
3 changes: 2 additions & 1 deletion packages/cxl-lumo-styles/scss/themes/vaadin-tab.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:host([theme~="cxl-marketing-nav"]) ::slotted(a[href]:hover) {
text-decoration: underline !important; /* stylelint-disable-line declaration-no-important */
// text-decoration: underline !important; /* stylelint-disable-line declaration-no-important */
color: var(--lumo-primary-color) !important; /* stylelint-disable-line declaration-no-important */
}

:host([theme~="cxl-marketing-nav"][hidden]) {
Expand Down
9 changes: 7 additions & 2 deletions packages/cxl-ui/scss/cxl-marketing-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
bottom: 0;
position: fixed;
}
*/
*/

/**
* Menu bar containers configuration.
Expand All @@ -39,12 +39,17 @@
#menu-shadow-items,
::slotted(#menu-global-items) {
background-color: var(--lumo-base-color);

:host([wide]) & {
height: 32px;
background-color: var(--lumo-shade);
}
}

// Light on dark.
::slotted(#menu-primary-items) {
--lumo-tertiary-text-color: var(--lumo-base-color);
background-color: var(--lumo-shade);
background-color: var(--lumo-base-color);
}

/**
Expand Down
62 changes: 60 additions & 2 deletions packages/cxl-ui/scss/global/cxl-marketing-nav.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
cxl-marketing-nav {
#menu-global-items {
min-height: 0;
}

#menu-global-items .menu-item {
color: var(--lumo-shade);
}

#menu-primary-items .menu-item {
color: var(--lumo-tint);
color: var(--lumo-shade);
}

&[wide] {
#menu-global-items .menu-item {
color: var(--lumo-base-color);
}

#menu-global-items .menu-item a {
opacity: 0.6;
}
}

&:not([wide]) {
Expand All @@ -10,6 +28,46 @@ cxl-marketing-nav {
}
}

#overlays-wrapper {
display: none;
}

@media screen and (min-width: 750px) {
#overlays-wrapper {
position: fixed;
z-index: 200;
display: flex;
background-color: var(--lumo-base-color);
border: 1px solid var(--lumo-base-color);
// Use top and bottom border prevent panel divider from reaching full height.
border-top-width: var(--lumo-space-m);
border-bottom-width: var(--lumo-space-m);
border-radius: 6px;
// 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.2s;

vaadin-context-menu-overlay[theme~="cxl-marketing-nav"] {
display: flex;
visibility: visible;
background-color: var(--lumo-base-color);
opacity: 1; // show after being moved to the overlays-wrapper element
transition: all 0.25s;

+ vaadin-context-menu-overlay[theme~="cxl-marketing-nav"] {
border-left: 1px solid var(--lumo-shade-20pct);
}
}

&[hidden] {
visibility: hidden;
opacity: 0;
transition: all 0.1s;
}
}
}

/**
* PARTIALLY CORRECT
* Apparently our element styles get hoisted also into `vaadin-overlay` shadow parts.
Expand Down Expand Up @@ -77,7 +135,7 @@ vaadin-context-menu-item[theme~="cxl-marketing-nav"] {

// Restricts menu item description width to max of parent width.
vaadin-context-menu-list-box {
--cxl-vaadin-context-menu-item-max-width: fit-content;
--cxl-vaadin-context-menu-item-max-width: 360px;
}

/**
Expand Down
Loading

0 comments on commit 2302393

Please sign in to comment.