Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 01b3b28

Browse files
authored
Blocks: Add rating to grid previews (#472)
* Add rating stars to the product preview * Add rating to the visibility controls
1 parent 6a36949 commit 01b3b28

File tree

19 files changed

+94
-2
lines changed

19 files changed

+94
-2
lines changed

assets/css/style.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
}
1818
}
1919

20+
&.is-hidden-rating {
21+
.star-rating {
22+
display: none;
23+
}
24+
}
25+
2026
&.is-hidden-button {
2127
.button[data-product_sku] {
2228
display: none !important;

assets/js/blocks/handpicked-products/block.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class ProductsBlock extends Component {
179179
'is-not-found': loaded && ! hasSelectedProducts,
180180
'is-hidden-title': ! contentVisibility.title,
181181
'is-hidden-price': ! contentVisibility.price,
182+
'is-hidden-rating': ! contentVisibility.rating,
182183
'is-hidden-button': ! contentVisibility.button,
183184
} );
184185

assets/js/blocks/handpicked-products/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ registerBlockType( 'woocommerce/handpicked-products', {
5858
default: {
5959
title: true,
6060
price: true,
61+
rating: true,
6162
button: true,
6263
},
6364
},
@@ -101,6 +102,7 @@ registerBlockType( 'woocommerce/handpicked-products', {
101102
{
102103
'is-hidden-title': ! contentVisibility.title,
103104
'is-hidden-price': ! contentVisibility.price,
105+
'is-hidden-rating': ! contentVisibility.rating,
104106
'is-hidden-button': ! contentVisibility.button,
105107
}
106108
);

assets/js/blocks/product-best-sellers/block.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class ProductBestSellersBlock extends Component {
131131
'is-not-found': loaded && ! products.length,
132132
'is-hidden-title': ! contentVisibility.title,
133133
'is-hidden-price': ! contentVisibility.price,
134+
'is-hidden-rating': ! contentVisibility.rating,
134135
'is-hidden-button': ! contentVisibility.button,
135136
} );
136137

assets/js/blocks/product-best-sellers/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ registerBlockType( 'woocommerce/product-best-sellers', {
6565
{
6666
'is-hidden-title': ! contentVisibility.title,
6767
'is-hidden-price': ! contentVisibility.price,
68+
'is-hidden-rating': ! contentVisibility.rating,
6869
'is-hidden-button': ! contentVisibility.button,
6970
}
7071
);

assets/js/blocks/product-category/block.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class ProductByCategoryBlock extends Component {
196196
'is-not-found': loaded && ! products.length,
197197
'is-hidden-title': ! contentVisibility.title,
198198
'is-hidden-price': ! contentVisibility.price,
199+
'is-hidden-rating': ! contentVisibility.rating,
199200
'is-hidden-button': ! contentVisibility.button,
200201
} );
201202

assets/js/blocks/product-category/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ registerBlockType( 'woocommerce/product-category', {
8484
{
8585
'is-hidden-title': ! contentVisibility.title,
8686
'is-hidden-price': ! contentVisibility.price,
87+
'is-hidden-rating': ! contentVisibility.rating,
8788
'is-hidden-button': ! contentVisibility.button,
8889
}
8990
);

assets/js/blocks/product-new/block.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class ProductNewestBlock extends Component {
133133
'is-not-found': loaded && ! products.length,
134134
'is-hidden-title': ! contentVisibility.title,
135135
'is-hidden-price': ! contentVisibility.price,
136+
'is-hidden-rating': ! contentVisibility.rating,
136137
'is-hidden-button': ! contentVisibility.button,
137138
} );
138139

assets/js/blocks/product-new/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ registerBlockType( 'woocommerce/product-new', {
6565
{
6666
'is-hidden-title': ! contentVisibility.title,
6767
'is-hidden-price': ! contentVisibility.price,
68+
'is-hidden-rating': ! contentVisibility.rating,
6869
'is-hidden-button': ! contentVisibility.button,
6970
}
7071
);

assets/js/blocks/product-on-sale/block.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class ProductOnSaleBlock extends Component {
145145
'is-not-found': loaded && ! products.length,
146146
'is-hidden-title': ! contentVisibility.title,
147147
'is-hidden-price': ! contentVisibility.price,
148+
'is-hidden-rating': ! contentVisibility.rating,
148149
'is-hidden-button': ! contentVisibility.button,
149150
} );
150151

0 commit comments

Comments
 (0)