diff --git a/_dev/css/dynamic/modal/_override.scss b/_dev/css/dynamic/modal/_override.scss index 004e035a..51dfaafd 100644 --- a/_dev/css/dynamic/modal/_override.scss +++ b/_dev/css/dynamic/modal/_override.scss @@ -1,60 +1,3 @@ .modal-content { background-clip: border-box; } - -.modal-fullscreen { - /* stylelint-disable */ - padding: 0 !important; // override inline padding-right added from js - /* stylelint-enable */ - .modal-dialog { - width: 100vw; - max-width: none; - height: 100%; - margin: 0; - } - - .modal-content { - height: 100%; - border: 0; - @include border-radius(0); - } - - .modal-body { - overflow-y: auto; - } -} - -.modal .modal-dialog-aside { - width: 100%; - height: 100%; - margin: 0; - transition: transform 0.2s; - transform: translate(0); - @include media-breakpoint-up(sm) { - max-width: 320px; - } -} - -.modal .modal-dialog-aside .modal-content { - height: inherit; - border: 0; - border-radius: 0; -} - -.modal .modal-dialog-aside .modal-content .modal-body { - overflow-y: auto; -} - -.modal.fixed-right .modal-dialog-aside { - margin-left: auto; - transform: translateX(100%); -} - -.modal.fixed-left .modal-dialog-aside { - margin-right: auto; - transform: translateX(-100%); -} - -.modal.show .modal-dialog-aside { - transform: translateX(0); -} diff --git a/_dev/css/dynamic/offcanvas/_index.scss b/_dev/css/dynamic/offcanvas/_index.scss new file mode 100644 index 00000000..68b66f1b --- /dev/null +++ b/_dev/css/dynamic/offcanvas/_index.scss @@ -0,0 +1 @@ +@import "override"; diff --git a/_dev/css/dynamic/offcanvas/_override.scss b/_dev/css/dynamic/offcanvas/_override.scss new file mode 100644 index 00000000..9c11e266 --- /dev/null +++ b/_dev/css/dynamic/offcanvas/_override.scss @@ -0,0 +1 @@ +// Styles override for the offcanvas component diff --git a/_dev/js/theme/components/dynamic-bootstrap-components.js b/_dev/js/theme/components/dynamic-bootstrap-components.js index f33901f2..ae25b61b 100644 --- a/_dev/js/theme/components/dynamic-bootstrap-components.js +++ b/_dev/js/theme/components/dynamic-bootstrap-components.js @@ -15,6 +15,17 @@ $(() => { ], }); + const importOffcanvas = new DynamicImportHandler({ + jqueryPluginCover: 'offcanvas', + DOMEvents: 'click', + DOMEventsSelector: '[data-bs-toggle="offcanvas"]', + DOMEventsPreventDefault: true, + files: () => [ + import('bootstrap/js/src/offcanvas'), + import('@css/dynamic/offcanvas/_index.scss'), + ], + }); + const importDropdown = new DynamicImportHandler({ jqueryPluginCover: 'dropdown', DOMEvents: 'click', diff --git a/templates/_partials/header.tpl b/templates/_partials/header.tpl index b10cb7c4..76d6c280 100644 --- a/templates/_partials/header.tpl +++ b/templates/_partials/header.tpl @@ -54,7 +54,8 @@ class="header-top__link" rel="nofollow" href="#" - data-bs-toggle="modal" + role="button" + data-bs-toggle="offcanvas" data-bs-target="#mobile_top_menu_wrapper" >
diff --git a/templates/_partials/modal-filters.tpl b/templates/_partials/modal-filters.tpl index 5809584c..6b2092a1 100644 --- a/templates/_partials/modal-filters.tpl +++ b/templates/_partials/modal-filters.tpl @@ -1,19 +1,18 @@ -{extends file='components/modal.tpl'} +{extends file='components/offcanvas.tpl'} -{block name='modal_extra_attribues'}id="mobile_filters" data-modal-hide-mobile{/block} -{block name='modal_extra_class'}fixed-right{/block} -{block name='modal_dialog_extra_class'}modal-dialog-aside{/block} -{block name='modal_title'}{l s='Filters' d='Shop.Theme.Catalog'}{/block} -{block name='modal_body_extra_class'}p-0{/block} -{block name='modal_body'} +{block name='offcanvas_extra_attribues'}id="mobile_filters"{/block} +{block name='offcanvas_extra_class'}offcanvas-end{/block} +{block name='offcanvas_title'}{l s='Filters' d='Shop.Theme.Catalog'}{/block} +{block name='offcanvas_body'}
-{/block} - -{block name='modal_footer'} - {/block} - diff --git a/templates/_partials/modal-menu.tpl b/templates/_partials/modal-menu.tpl index c66c3134..1ba2a54b 100644 --- a/templates/_partials/modal-menu.tpl +++ b/templates/_partials/modal-menu.tpl @@ -1,16 +1,12 @@ -{extends file='components/modal.tpl'} +{extends file='components/offcanvas.tpl'} -{block name='modal_extra_attribues'}id="mobile_top_menu_wrapper" data-modal-hide-mobile{/block} -{block name='modal_extra_class'}fixed-left{/block} -{block name='modal_dialog_extra_class'}modal-dialog-aside{/block} -{block name='modal_title'}{l s='Menu' d='Shop.Theme.Catalog'}{/block} -{block name='modal_body'} +{block name='offcanvas_extra_attribues'}id="mobile_top_menu_wrapper"{/block} +{block name='offcanvas_title'}{l s='Menu' d='Shop.Theme.Catalog'}{/block} +{block name='offcanvas_body'}
-
{/block} - diff --git a/templates/_partials/modal-search.tpl b/templates/_partials/modal-search.tpl index e261473f..dfe69dbf 100644 --- a/templates/_partials/modal-search.tpl +++ b/templates/_partials/modal-search.tpl @@ -1,11 +1,10 @@ -{extends file='components/modal.tpl'} +{extends file='components/offcanvas.tpl'} -{block name='modal_extra_attribues'}id="saerchModal" data-modal-hide-mobile{/block} -{block name='modal_extra_class'}modal-fullscreen search-modal{/block} -{block name='modal_header'}{/block} -{block name='modal_body'} -
diff --git a/templates/catalog/_partials/products-top.tpl b/templates/catalog/_partials/products-top.tpl index 95d9a3e6..92786fff 100644 --- a/templates/catalog/_partials/products-top.tpl +++ b/templates/catalog/_partials/products-top.tpl @@ -37,10 +37,10 @@
{if !empty($listing.rendered_facets)} - - {/if} diff --git a/templates/components/modal.tpl b/templates/components/modal.tpl index dad671ba..ec811ede 100644 --- a/templates/components/modal.tpl +++ b/templates/components/modal.tpl @@ -1,7 +1,12 @@ {block name='modal'} -