diff options
| author | Cocographique <nmi@odoo.com> | 2020-08-21 11:12:27 +0000 |
|---|---|---|
| committer | Xavier-Do <xdo@odoo.com> | 2020-08-27 17:07:34 +0000 |
| commit | 0b265a6564133b40e1b3090f736a0af24900188a (patch) | |
| tree | 66613ab22d10fd0aac72db7eeb2d02f9d07eae37 /addons/website/static/src | |
| parent | 53a0565632a874ca62d3b4f5ba2bde338ac067aa (diff) | |
[IMP] website, *: add 'hamburger full' header template
*: website_sale, website_sale_wishlist
Part of https://github.com/odoo/odoo/pull/56427
task-2264627
Co-authored-by: qsm-odoo <qsm@odoo.com>
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/content/snippets.animation.js | 19 | ||||
| -rw-r--r-- | addons/website/static/src/scss/website.scss | 76 |
2 files changed, 90 insertions, 5 deletions
diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index 7de8fbef029..a68e8555c1d 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -978,6 +978,25 @@ registry.FooterSlideout = publicWidget.Widget.extend({ }, }); +registry.HeaderHamburgerFull = publicWidget.Widget.extend({ + selector: 'header:has(.o_header_hamburger_full_toggler):not(:has(.o_offcanvas_menu_toggler))', + events: { + 'click .o_header_hamburger_full_toggler': '_onToggleClick', + }, + + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + + /** + * @private + */ + _onToggleClick() { + document.body.classList.add('overflow-hidden'); + setTimeout(() => $(window).trigger('scroll'), 100); + }, +}); + return { Widget: publicWidget.Widget, Animation: Animation, diff --git a/addons/website/static/src/scss/website.scss b/addons/website/static/src/scss/website.scss index b901ecabb97..0d5fb8a161d 100644 --- a/addons/website/static/src/scss/website.scss +++ b/addons/website/static/src/scss/website.scss @@ -823,17 +823,28 @@ header { @if $-off-canvas-hamburger { #top_menu_collapse { - flex-direction: if($-hamburger-left, row, row-reverse); &.collapsing, &.show { @include o-position-absolute(0, 0, 0, 0); position: fixed; - display: flex; - align-items: stretch; z-index: $zindex-sticky; transition: none; transform: none; + &, & > .o_header_collapsed_content_wrapper { + // TODO improve: ugly code to reset a potential wrapper + display: flex !important; + flex-flow: if($-hamburger-left, row, row-reverse) nowrap !important; + align-items: stretch !important; + justify-content: flex-start !important; + } + > .o_header_collapsed_content_wrapper { + // TODO improve: ugly code to reset a potential wrapper + max-width: none !important; + padding: 0 !important; + margin: 0 !important; + } + .o_offcanvas_menu_backdrop { @include o-position-absolute(0, 0, 0, 0); opacity: .2; @@ -843,12 +854,13 @@ header { #top_menu { flex: 0 0 auto !important; overflow: auto; - flex-wrap: nowrap; + flex-flow: column nowrap !important; @if $-hamburger-center { width: 100%; max-width: none; } @else { max-width: 560px; + text-align: left !important; } min-width: 250px; margin: 0 !important; @@ -871,6 +883,13 @@ header { .nav-item, .dropdown-menu { text-align: inherit; } + .nav-item, .nav-link { + margin: 0 !important; + } + + .navbar-toggler { + display: block !important; + } // Open all dropdowns .dropdown-toggle { @@ -895,7 +914,7 @@ header { .o_connected_user header:not(.o_header_is_scrolled) &, .o_connected_user header.o_header_affixed & { - padding-top: $o-navbar-height; + padding-top: $o-navbar-height !important; } } &.collapsing #top_menu { @@ -997,6 +1016,53 @@ header { width: 50%; } } +} @else if o-website-value('header-template') == 'hamburger-full' { + @if not $-off-canvas-hamburger { + @include media-breakpoint-up(md) { + #wrapwrap { + $o-hamburger-full-navbar-height: $o-theme-navbar-logo-height + ($navbar-padding-y * 2); + > header { + .navbar-collapse { + > .container { + height: calc(100vh - #{$o-navbar-height} - #{$o-hamburger-full-navbar-height}); + transition: height .3s ease; + } + .nav-link { + padding-right: $nav-link-padding-x; + padding-left: $nav-link-padding-x; + } + .dropdown-menu { + position: absolute; + } + } + &:not(.o_header_affixed) { + position: sticky; + top: 0; + right: 0; + bottom: auto; + left: 0; + z-index: $zindex-fixed; + } + &.o_header_affixed { + transform: none !important; + } + } + > main { + > :first-child:not(#wrap), #wrap > :first-child { + &::before { + content: ""; + display: block; + width: 100%; + margin-top: $o-hamburger-full-navbar-height; + } + } + } + } + #oe_main_menu_navbar ~ #wrapwrap > header { + top: $o-navbar-height; + } + } + } } // Mega menu |
