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

Commit 544010a

Browse files
authored
Merge branch 'trunk' into dev/refactor-prod-control-ts
2 parents adda87f + 6f58d5a commit 544010a

File tree

21 files changed

+201
-52
lines changed

21 files changed

+201
-52
lines changed

assets/js/base/components/price-slider/style.scss

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,10 @@
331331
}
332332
.wc-block-components-price-slider__range-input-progress {
333333
--range-color: currentColor;
334-
margin: -$border-width;
335334
}
336335
.wc-block-price-filter__range-input {
337336
background: transparent;
338-
margin: -$border-width;
337+
height: 0;
339338
width: calc(100% + #{$border-width * 2});
340339
&:hover,
341340
&:focus {
@@ -350,13 +349,24 @@
350349
}
351350
}
352351
&::-webkit-slider-thumb {
353-
margin-top: -9px;
352+
background: $white;
353+
margin-top: -6px;
354+
width: 12px;
355+
height: 12px;
354356
}
355357
&.wc-block-components-price-slider__range-input--max::-moz-range-thumb {
356-
transform: translate(2px, 1px);
358+
background: $white;
359+
transform: translate(2px, 2px);
360+
width: 12px;
361+
height: 12px;
362+
box-sizing: content-box;
357363
}
358364
&.wc-block-components-price-slider__range-input--min::-moz-range-thumb {
359-
transform: translate(-2px, 1px);
365+
background: $white;
366+
transform: translate(-2px, 2px);
367+
width: 12px;
368+
height: 12px;
369+
box-sizing: content-box;
360370
}
361371
&::-ms-track {
362372
border-color: transparent !important;

assets/js/blocks/migration-products-to-product-collection/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import type { UpgradeNoticeStatus, UpgradeNoticeStatuses } from './types';
55

66
export const AUTO_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION = false;
7-
export const MANUAL_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION = false;
7+
export const MANUAL_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION = true;
88
export const HOURS_TO_DISPLAY_UPGRADE_NOTICE = 72;
99
export const UPGRADE_NOTICE_DISPLAY_COUNT_THRESHOLD = 4;
1010
export const MIGRATION_STATUS_LS_KEY =

assets/js/blocks/product-collection/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"apiVersion": 2,
44
"name": "woocommerce/product-collection",
55
"version": "1.0.0",
6-
"title": "Product Collection",
6+
"title": "Product Collection (Beta)",
77
"description": "Display a collection of products from your store.",
88
"category": "woocommerce",
99
"keywords": [ "WooCommerce", "Products (Beta)" ],

assets/js/blocks/product-collection/index.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* External dependencies
33
*/
44
import { registerBlockType } from '@wordpress/blocks';
5-
import { isExperimentalBuild } from '@woocommerce/block-settings';
65

76
/**
87
* Internal dependencies
@@ -11,12 +10,13 @@ import metadata from './block.json';
1110
import edit from './edit';
1211
import save from './save';
1312
import icon from './icon';
14-
import './variations';
13+
import registerProductSummaryVariation from './variations/elements/product-summary';
14+
import registerProductTitleVariation from './variations/elements/product-title';
1515

16-
if ( isExperimentalBuild() ) {
17-
registerBlockType( metadata, {
18-
icon,
19-
edit,
20-
save,
21-
} );
22-
}
16+
registerBlockType( metadata, {
17+
icon,
18+
edit,
19+
save,
20+
} );
21+
registerProductSummaryVariation();
22+
registerProductTitleVariation();

assets/js/blocks/product-collection/variations/elements/product-summary.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ import {
1616
export const CORE_NAME = 'core/post-excerpt';
1717
export const VARIATION_NAME = 'woocommerce/product-collection/product-summary';
1818

19-
registerElementVariation( CORE_NAME, {
20-
blockDescription: BLOCK_DESCRIPTION,
21-
blockIcon: <Icon icon={ page } />,
22-
blockTitle: BLOCK_TITLE,
23-
variationName: VARIATION_NAME,
24-
} );
19+
const registerProductSummary = () => {
20+
registerElementVariation( CORE_NAME, {
21+
blockDescription: BLOCK_DESCRIPTION,
22+
blockIcon: <Icon icon={ page } />,
23+
blockTitle: BLOCK_TITLE,
24+
variationName: VARIATION_NAME,
25+
} );
26+
};
27+
28+
export default registerProductSummary;

assets/js/blocks/product-collection/variations/elements/product-title.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ import {
1616
export const CORE_NAME = 'core/post-title';
1717
export const VARIATION_NAME = 'woocommerce/product-collection/product-title';
1818

19-
registerElementVariation( CORE_NAME, {
20-
blockDescription: BLOCK_DESCRIPTION,
21-
blockIcon: <Icon icon={ heading } />,
22-
blockTitle: BLOCK_TITLE,
23-
variationName: VARIATION_NAME,
24-
} );
19+
const registerProductTitle = () => {
20+
registerElementVariation( CORE_NAME, {
21+
blockDescription: BLOCK_DESCRIPTION,
22+
blockIcon: <Icon icon={ heading } />,
23+
blockTitle: BLOCK_TITLE,
24+
variationName: VARIATION_NAME,
25+
} );
26+
};
27+
28+
export default registerProductTitle;

assets/js/blocks/product-collection/variations/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { CORE_NAME as PRODUCT_SUMMARY_ID } from './elements/product-summary';
1313

1414
const EXTENDED_CORE_ELEMENTS = [ PRODUCT_SUMMARY_ID, PRODUCT_TITLE_ID ];
1515

16-
function registerProductQueryElementsNamespace(
16+
function registerProductCollectionElementsNamespace(
1717
props: Block,
1818
blockName: string
1919
) {
@@ -36,6 +36,6 @@ if ( isWpVersion( '6.1', '>=' ) ) {
3636
addFilter(
3737
'blocks.registerBlockType',
3838
'core/custom-class-name/attribute',
39-
registerProductQueryElementsNamespace
39+
registerProductCollectionElementsNamespace
4040
);
4141
}

assets/js/blocks/product-gallery/block.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"keywords": [ "WooCommerce" ],
1010
"supports": {
1111
"align": true,
12-
"multiple": false
12+
"multiple": false,
13+
"interactivity": true
1314
},
1415
"textdomain": "woo-gutenberg-products-block",
1516
"providesContext": {
@@ -47,5 +48,6 @@
4748
"type": "boolean",
4849
"default": false
4950
}
50-
}
51+
},
52+
"viewScript": "wc-product-gallery-interactivity-frontend"
5153
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import { store as interactivityApiStore } from '@woocommerce/interactivity';
5+
6+
interface State {
7+
[ key: string ]: unknown;
8+
}
9+
10+
interface Context {
11+
productGallery: { numberOfThumbnails: number };
12+
}
13+
14+
interface Selectors {
15+
productGallery: {
16+
getNumberOfPages: ( store: unknown ) => number;
17+
};
18+
}
19+
20+
interface Store {
21+
state: State;
22+
context: Context;
23+
selectors: Selectors;
24+
ref: HTMLElement;
25+
}
26+
27+
type SelectorsStore = Pick< Store, 'context' | 'selectors' >;
28+
29+
interactivityApiStore( {
30+
selectors: {
31+
productGallery: {
32+
getNumberOfPages: ( store: SelectorsStore ) => {
33+
const { context } = store;
34+
35+
return context.productGallery.numberOfThumbnails;
36+
},
37+
},
38+
},
39+
} as Store );

assets/js/blocks/product-query/variations/elements/product-summary.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ registerElementVariation( CORE_NAME, {
2121
blockIcon: <Icon icon={ page } />,
2222
blockTitle: BLOCK_TITLE,
2323
variationName: VARIATION_NAME,
24+
scope: [ 'block' ],
2425
} );

0 commit comments

Comments
 (0)