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

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

resources/assets/scss/_config.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
@import "~bootstrap/scss/mixins/grid";
2121
@import "~bootstrap/scss/grid";
2222

23+
// SimpleBar
24+
@import "~simplebar/src/simplebar.css";
25+
2326
/**
2427
* Internal dependencies
2528
*/

resources/assets/scss/modules/products-categories.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
// [1] Give any potential scrollbar more room so it does not overlap.
1+
.woocommerce-product-categories-wrapper {
2+
-webkit-overflow-scrolling: touch;
3+
margin-bottom: $spacer;
4+
}
5+
26
.woocommerce-page ul.products-categories,
37
.woocommerce ul.products-categories {
48
display: flex;
5-
overflow-x: scroll;
6-
-webkit-overflow-scrolling: touch;
79
position: relative;
8-
padding-bottom: $spacer; // [1]
10+
11+
@include reset-list();
12+
913
padding-left: 2px;
1014
padding-right: 2px;
1115

@@ -17,10 +21,7 @@
1721
border-radius: $border-radius;
1822
}
1923

20-
2124
@include gray("background", "200");
22-
bottom: $spacer;
23-
height: calc(100% - #{$spacer});
2425
}
2526

2627
@include vertical-spacing("margin", "down", (

resources/assets/scss/modules/woocommerce-account.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// [1] Give any potential scrollbar more room so it does not overlap.
21
.woocommerce-MyAccount-navigation {
32
margin: -($spacer) 0 $spacer;
3+
padding: 0 0 $spacer;
44
position: relative;
5+
-webkit-overflow-scrolling: touch;
56

67
&::after {
78
content: "";
@@ -21,11 +22,9 @@
2122

2223
@include reset-list();
2324

24-
padding: 0 0 $spacer; // [1]
25+
margin: 0;
26+
padding: 0;
2527
display: flex;
26-
overflow-x: scroll;
27-
overflow-y: hidden;
28-
-webkit-overflow-scrolling: touch;
2928

3029
li {
3130
flex: 1 0 auto;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Product Loop End
4+
*
5+
* This template can be overridden by copying it to yourtheme/woocommerce/loop/loop-end.php.
6+
*
7+
* HOWEVER, on occasion WooCommerce will need to update template files and you
8+
* (the theme developer) will need to copy the new files to your theme to
9+
* maintain compatibility. We try to do this as little as possible, but it does
10+
* happen. When this occurs the version of the template file will be bumped and
11+
* the readme will list any important changes.
12+
*
13+
* @see https://docs.woocommerce.com/document/template-structure/
14+
* @package WooCommerce/Templates
15+
* @version 2.0.0
16+
*/
17+
18+
if ( ! defined( 'ABSPATH' ) ) {
19+
exit;
20+
}
21+
22+
$main = 'main' === wc_get_loop_prop( 'products-loop' );
23+
?>
24+
25+
</ul>
26+
27+
<?php if ( ! $main ) : ?>
28+
</div>
29+
<?php endif; ?>

resources/views/integrations/woocommerce/loop/loop-start.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
);
3939
?>
4040

41+
<?php if ( ! $main ) : ?>
42+
<div class="woocommerce-product-categories-wrapper">
43+
<?php endif; ?>
44+
4145
<ul class="<?php echo esc_attr( $classes ); ?>">
4246

4347
<?php if ( bigbox_is_integration_active( 'facetwp' ) && $main ) : ?>

webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ const config = {
114114
jquery: 'jQuery',
115115
$: 'jQuery',
116116
'@wordpress/element': 'wp.element',
117+
simplebar: 'window.SimpleBar',
117118
},
118119
plugins: [
119120
new SpritePlugin(),
@@ -122,6 +123,10 @@ const config = {
122123
from: 'resources/assets/images/icons',
123124
to: 'public/images/icons',
124125
},
126+
{
127+
from: './node_modules/simplebar/dist/simplebar.min.js',
128+
to: 'public/js/simplebar.min.js',
129+
},
125130
] ),
126131
new MiniCssExtractPlugin( {
127132
filename: './public/css/[name].min.css',

0 commit comments

Comments
 (0)