Skip to content

Commit fa740f8

Browse files
Merge branch 'release/3.4.0' of github.com:bigboxwc/bigbox into release/3.4.0
2 parents e1743b2 + 83e1f05 commit fa740f8

File tree

16 files changed

+132
-15
lines changed

16 files changed

+132
-15
lines changed

app/integrations/facetwp/template-functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function bigbox_facetwp_wp_enqueue_scripts() {
2424

2525
$deps = [
2626
$stylesheet,
27+
( $stylesheet . '-simplebar' ),
2728
'jquery',
2829
];
2930

app/integrations/woocommerce/template-functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function bigbox_woocommerce_wp_enqueue_scripts() {
4040

4141
$deps = [
4242
$stylesheet,
43+
( $stylesheet . '-simplebar' ),
4344
'wp-util',
4445
'woocommerce',
4546
];

app/integrations/woocommerce/wc-template-functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ function woocommerce_output_product_categories( $args = [] ) {
7878
if ( $total > 5 ) {
7979
$product_categories = array_slice( $product_categories, 0, 5 );
8080
}
81+
8182
// End modification.
8283
if ( ! $product_categories ) {
8384
return false;

app/theme/assets.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,21 @@ function bigbox_enqueue_scripts() {
7373
$version = bigbox_get_theme_version();
7474
$stylesheet = bigbox_get_theme_name();
7575

76+
// SimpleBar.
77+
wp_enqueue_script(
78+
$stylesheet . '-simplebar',
79+
get_template_directory_uri() . '/public/js/simplebar.min.js',
80+
array(),
81+
'4.1.0',
82+
true
83+
);
84+
7685
$deps = [
7786
'hoverIntent',
87+
( $stylesheet . '-simplebar' ),
7888
];
7989

80-
// Combined application scripts.
90+
// Application script.
8191
wp_enqueue_script(
8292
$stylesheet,
8393
get_template_directory_uri() . '/public/js/app.min.js',

package-lock.json

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"postcss-loader": "3.0.0",
3737
"raw-loader": "3.1.0",
3838
"sass-loader": "7.2.0",
39+
"simplebar": "4.1.0",
3940
"stylelint": "10.1.0",
4041
"stylelint-config-wordpress": "14.0.0",
4142
"svg-sprite-loader": "4.1.6",

resources/assets/js/app/horizontal-menu.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global SimpleBar */
2+
13
/**
24
* Scroll a horizontal menu to the active item.
35
*
@@ -11,6 +13,8 @@ const horizontalMenu = ( menuClass, activeClass ) => {
1113
return;
1214
}
1315

16+
// Custom scrolling.
17+
const simpleBar = new SimpleBar( menu );
1418
const activeLink = document.querySelector( `${ menuClass } ${ activeClass }` );
1519

1620
if ( ! activeLink ) {
@@ -20,7 +24,7 @@ const horizontalMenu = ( menuClass, activeClass ) => {
2024
const activeOffset = activeLink.getBoundingClientRect();
2125
const menuOffset = menu.getBoundingClientRect();
2226

23-
menu.scrollLeft = activeOffset.x + ( activeOffset.width / 2 ) + menu.scrollLeft - ( menuOffset.width / 2 );
27+
simpleBar.getScrollElement().scrollLeft = activeOffset.x + ( activeOffset.width / 2 ) + menu.scrollLeft - ( menuOffset.width / 2 );
2428
};
2529

2630
export default horizontalMenu;

resources/assets/js/woocommerce/account-menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ import domReady from '@wordpress/dom-ready';
88
*/
99
import horizontalMenu from './../app/horizontal-menu.js';
1010

11-
domReady( horizontalMenu( '.woocommerce-MyAccount-navigation ul', '.is-active' ) );
11+
domReady( horizontalMenu( '.woocommerce-MyAccount-navigation', '.is-active' ) );
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* External dependencies.
3+
*/
4+
import domReady from '@wordpress/dom-ready';
5+
6+
/**
7+
* Internal dependencies.
8+
*/
9+
import horizontalMenu from './../app/horizontal-menu.js';
10+
11+
domReady( horizontalMenu( '.woocommerce-product-categories-wrapper' ) );

resources/assets/js/woocommerce/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ import './checkout.js';
1717
import './products.js';
1818
import './lazyload.js';
1919
import './account-menu.js';
20+
import './category-menu.js';

0 commit comments

Comments
 (0)