woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Malith Senaweera 65835d3689 Fix duplicated error notices (https://github.com/woocommerce/woocommerce-blocks/pull/5476)
* Fix duplicated error notices

StoreNoticeProvider is already being used within Block component. This
removal prevents duplicated error notices within the Payment Options
section

* Move StoreNoticeProvider from payment block

Remove StoreNoticeProvider from payment block and move it to the parent
frontend block to avoid unnecessarily loading the notice provider
2022-01-04 17:37:46 +00:00
..
active-filters Add global style for Active Filters block (https://github.com/woocommerce/woocommerce-blocks/pull/5465) 2022-01-03 10:41:19 +01:00
attribute-filter Add E2E tests for Filter blocks (Price, Attribute, and Active Filters) (https://github.com/woocommerce/woocommerce-blocks/pull/4562) 2021-12-23 17:26:10 +01:00
cart-checkout Fix duplicated error notices (https://github.com/woocommerce/woocommerce-blocks/pull/5476) 2022-01-04 17:37:46 +00:00
featured-category Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
featured-product Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
handpicked-products Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
legacy-template Add correct class to Legacy Template block icon (https://github.com/woocommerce/woocommerce-blocks/pull/5400) 2021-12-16 13:29:55 +01:00
price-filter Add E2E tests for Filter blocks (Price, Attribute, and Active Filters) (https://github.com/woocommerce/woocommerce-blocks/pull/4562) 2021-12-23 17:26:10 +01:00
product-best-sellers Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
product-categories Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
product-category Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
product-new Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
product-on-sale Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
product-search Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
product-tag Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
product-top-rated Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
products Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
products-by-attribute Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
reviews Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
single-product Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363) 2021-12-10 21:32:44 +07:00
stock-filter Remove text decorations from product filter (https://github.com/woocommerce/woocommerce-blocks/pull/5384) 2021-12-22 15:33:37 +07:00
README.md Remove deprecated shortcode save handling from SSR Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/4010) 2021-04-08 13:42:03 +01: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.