woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Saad Tarhi 13024c88e6 Fix crash in WooExpress Cart & Checkout Editor (https://github.com/woocommerce/woocommerce-blocks/pull/11024) 2023-09-22 19:10:50 +01:00
..
active-filters Add a generic arg to useCollection to improve typing of results. (https://github.com/woocommerce/woocommerce-blocks/pull/10696) 2023-08-24 04:49:41 +00:00
attribute-filter Add a generic arg to useCollection to improve typing of results. (https://github.com/woocommerce/woocommerce-blocks/pull/10696) 2023-08-24 04:49:41 +00: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 Fixes for jest transpilation issues. (https://github.com/woocommerce/woocommerce-blocks/pull/10788) 2023-09-05 04:03:35 +00:00
cart-checkout-shared Fix crash in WooExpress Cart & Checkout Editor (https://github.com/woocommerce/woocommerce-blocks/pull/11024) 2023-09-22 19:10:50 +01:00
catalog-sorting Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
checkout Fixes for jest transpilation issues. (https://github.com/woocommerce/woocommerce-blocks/pull/10788) 2023-09-05 04:03:35 +00:00
classic-shortcode Feature Branch: Blockified Order Confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/10056) 2023-09-20 13:56:00 +01:00
classic-template Feature Branch: Blockified Order Confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/10056) 2023-09-20 13:56:00 +01:00
collection-filters Add collection filters block (https://github.com/woocommerce/woocommerce-blocks/pull/10726) 2023-09-14 11:13:33 +07: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 Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +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 Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
migration-products-to-product-collection Enable Product Collection as a core feature (https://github.com/woocommerce/woocommerce-blocks/pull/10524) 2023-08-25 15:58:11 +02:00
mini-cart Add Color Panel (https://github.com/woocommerce/woocommerce-blocks/pull/10062) 2023-07-21 10:35:32 +01:00
order-confirmation Feature Branch: Blockified Order Confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/10056) 2023-09-20 13:56:00 +01:00
page-content-wrapper Feature Branch: Blockified Order Confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/10056) 2023-09-20 13:56:00 +01:00
price-filter Upgrade webpack to version 5 (https://github.com/woocommerce/woocommerce-blocks/pull/8013) 2023-09-20 17:31:52 -03: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 Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
product-collection Transfer layout options from Toolbar to Inspector controls (https://github.com/woocommerce/woocommerce-blocks/pull/10922) 2023-09-15 15:38:48 +05:30
product-gallery Product Gallery Large Image: Add wrapper to fix zoom (https://github.com/woocommerce/woocommerce-blocks/pull/11023) 2023-09-22 13:48:51 +02:00
product-new Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01: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 Change default number of columns in Related Products (https://github.com/woocommerce/woocommerce-blocks/pull/10875) 2023-09-10 10:26:56 +02: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 Convert product tag control to functional component (https://github.com/woocommerce/woocommerce-blocks/pull/10529) 2023-08-15 17:40:05 +01:00
product-template Hide unexpected bullet point in Product Collection on Storefront (https://github.com/woocommerce/woocommerce-blocks/pull/10945) 2023-09-15 08:07:54 +02: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 Open links from the Editor in the top frame, not editor iframe (https://github.com/woocommerce/woocommerce-blocks/pull/10515) 2023-08-16 11:03:50 +02:00
products-by-attribute Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
rating-filter Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
reviews Refactor frontend, frontend-container-block (of reviews) to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/10787) 2023-09-20 04:21:26 +00: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 Single Product block: Add wide and full-width alignments support (https://github.com/woocommerce/woocommerce-blocks/pull/8981) 2023-04-27 16:44:10 -03:00
stock-filter Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
store-notices Refactor Cart and Checkout Page Templates (https://github.com/woocommerce/woocommerce-blocks/pull/10773) 2023-09-19 10:58:18 +01: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.