woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Arsany Benyamine 0672f73723 replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933)
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-12-09 00:30:33 +01:00
..
active-filters Move `Label` component to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11275) 2023-10-20 07:03:00 -07:00
attribute-filter replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
breadcrumbs Fix icon color when block is selected in List View (https://github.com/woocommerce/woocommerce-blocks/pull/10652) 2023-08-18 18:03:53 +00:00
cart Fix font weight of cart totals title in site editor (https://github.com/woocommerce/woocommerce-blocks/pull/12051) 2023-12-07 15:55:47 +07:00
cart-checkout-shared Convert PaymentMethodErrorBoundary to Class component (https://github.com/woocommerce/woocommerce-blocks/pull/12088) 2023-12-08 16:28:55 +00:00
catalog-sorting Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
checkout replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
classic-shortcode Cart and Checkout block transforms for classic shortcodes (https://github.com/woocommerce/woocommerce-blocks/pull/11228) 2023-10-19 16:43:43 +01:00
classic-template replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
collection-filters replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
customer-account Fix customer account icon not scaling in certain environments (https://github.com/woocommerce/woocommerce-blocks/pull/10533) 2023-09-02 16:07:01 +02:00
featured-items replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
filter-wrapper Refactor Filter Wrapper to remove usage of useInnerBlocksProps (https://github.com/woocommerce/woocommerce-blocks/pull/8095) 2023-01-04 17:31:17 +07:00
handpicked-products replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
migration-products-to-product-collection Simplify Product Collection query attributes by removing attributes which are never used (https://github.com/woocommerce/woocommerce-blocks/pull/11259) 2023-10-18 12:47:55 +02:00
mini-cart Implement the Block Hooks API to automatically inject the Mini-Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/11745) 2023-12-04 17:27:27 +01:00
order-confirmation Improve readability of order note (https://github.com/woocommerce/woocommerce-blocks/pull/11944) 2023-11-29 21:39:07 +07:00
page-content-wrapper Investigate E2E CI caching issue (https://github.com/woocommerce/woocommerce-blocks/pull/11874) 2023-11-28 14:16:45 +07:00
price-filter replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
product-best-sellers Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
product-categories Enable declaration-block-no-duplicate-properties stylelint rule (https://github.com/woocommerce/woocommerce-blocks/pull/10163) 2023-07-11 13:03:05 +00:00
product-category replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
product-collection Restructure Product Collection editor files (https://github.com/woocommerce/woocommerce-blocks/pull/11981) 2023-12-06 15:50:24 +01:00
product-gallery Product gallery/fix/view all link (https://github.com/woocommerce/woocommerce-blocks/pull/11995) 2023-12-05 16:25:41 +01:00
product-new Bump @wordpress/icons from 6.1.1 to 9.36.0 (https://github.com/woocommerce/woocommerce-blocks/pull/11611) 2023-11-16 17:40:53 +00:00
product-on-sale Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
product-query Translate Related Products heading in Single Product template (https://github.com/woocommerce/woocommerce-blocks/pull/11693) 2023-11-09 09:00:23 +01:00
product-results-count Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
product-search Remove `propTypes` definitions from Product Search block (https://github.com/woocommerce/woocommerce-blocks/pull/9565) 2023-05-24 19:24:08 +07:00
product-tag replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
product-template fix: Product Collection: Featured Products 5 Columns improve spacing (https://github.com/woocommerce/woocommerce-blocks/pull/12041) 2023-12-06 09:05:49 +01:00
product-top-rated Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
products replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
products-by-attribute replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
rating-filter Filter By Rating: fix overlapping stars (https://github.com/woocommerce/woocommerce-blocks/pull/11644) 2023-11-07 10:59:36 +00:00
reviews replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
shared/styles Add logic of Upgrade Notice after upgrading Products to Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10267) 2023-08-18 08:25:15 +02:00
single-product replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933) 2023-12-09 00:30:33 +01:00
stock-filter Move `CheckboxList` and create new `blocksComponents` package (https://github.com/woocommerce/woocommerce-blocks/pull/11214) 2023-10-17 02:47:34 -07:00
store-notices Switch to NoticeBanner component inside Store Notices Block placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/11920) 2023-11-27 13:43:42 +00:00
README.md Remove propTypes definitions from Newest Products block (https://github.com/woocommerce/woocommerce-blocks/pull/9613) 2023-05-29 13:12:36 +07:00

README.md

Blocks

Our blocks are generally made up of up to 4 files:

|- block.js
|- editor.scss
|- index.js
|- style.scss

The only required file is index.js, this sets up the block using registerBlockType. Each block has edit and save functions.

The scss files are split so that things in style are added to the editor and frontend, while styles in editor are only added to the editor. Most of our blocks should use core components that won't need CSS though.

Editing

A simple edit function can live in index.js, but most blocks are a little more complicated, so the edit function instead returns a Block component, which lives in block.js. By using a component, we can use React lifecycle methods to fetch data or save state.

The Newest Products block is a good example to read over, this is a simple block that fetches the products and renders them using the ProductPreview component.

We include settings in the sidebar, called the Inspector in gutenberg. See an example of this.

Other blocks have the concept of an "edit state", like when you need to pick a product in the Featured Product block, or pick a category in the Products by Category block.