woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Daniel Dudzic 3700c1c42d Product Gallery: Add an new block base code (https://github.com/woocommerce/woocommerce-blocks/pull/9937)
* Product Gallery: Add an new block base code

* Product Gallery: Add experimental flag

* Product Gallery: Move the block from registerBlockType to registerBlockSingleProductTemplate

* Product Gallery: Update icon
2023-07-03 14:21:31 +00:00
..
active-filters Remove attributes data from save function for active filters (https://github.com/woocommerce/woocommerce-blocks/pull/10047) 2023-07-03 06:52:31 -07:00
attribute-filter Add back filter blocks frontend scripts (https://github.com/woocommerce/woocommerce-blocks/pull/9954) 2023-06-22 16:09:37 +02:00
breadcrumbs Fixes CSS spacing and availability issues for breadcrumb, catalog sort, and result count blocks. (https://github.com/woocommerce/woocommerce-blocks/pull/8391) 2023-02-14 05:53:33 -05:00
cart Add `CartEventContext` and dispatch events when pressing proceed to checkout button (https://github.com/woocommerce/woocommerce-blocks/pull/7809) 2023-06-19 08:44:37 -07:00
cart-checkout-shared Add Cart/Checkout/Order-Received Templates (https://github.com/woocommerce/woocommerce-blocks/pull/9301) 2023-06-29 14:41:22 +01:00
catalog-sorting Fix Catalog Sorting default color in dark backgrounds (https://github.com/woocommerce/woocommerce-blocks/pull/8483) 2023-02-21 13:59:13 +01:00
checkout Add text limit to payment method descriptions in the page editor (https://github.com/woocommerce/woocommerce-blocks/pull/9708) 2023-06-07 02:29:15 -07:00
classic-template Product Image Gallery block: Fix overflow when multiple images are used (https://github.com/woocommerce/woocommerce-blocks/pull/10013) 2023-06-29 20:24:33 +02:00
customer-account Allow customer account block to center align (https://github.com/woocommerce/woocommerce-blocks/pull/9750) 2023-06-22 05:41:06 -07:00
featured-items Experiment: Replace style hooks coming from `@wordpress/block-editor` (https://github.com/woocommerce/woocommerce-blocks/pull/9251) 2023-05-12 13:42:16 +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 ESLint errors (https://github.com/woocommerce/woocommerce-blocks/pull/7556) 2022-11-02 17:46:14 +01:00
mini-cart Prevent prefetched Cart payload causing wrong values with cached Mini-Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/10029) 2023-06-30 16:05:27 +02:00
price-filter Remove attributes data from save function for filter by price (https://github.com/woocommerce/woocommerce-blocks/pull/10039) 2023-07-03 05:39:45 -07:00
product-best-sellers Fix/you do not need lodash (https://github.com/woocommerce/woocommerce-blocks/pull/9161) 2023-04-28 11:29:45 +01:00
product-categories Removed proptypes and js to ts conversion for Product Categories (https://github.com/woocommerce/woocommerce-blocks/pull/9755) 2023-06-12 18:52:21 +02:00
product-category Fix/you do not need lodash (https://github.com/woocommerce/woocommerce-blocks/pull/9161) 2023-04-28 11:29:45 +01:00
product-collection Add E2E tests for Product Collection Block (https://github.com/woocommerce/woocommerce-blocks/pull/9825) 2023-06-20 10:56:12 +05:30
product-gallery Product Gallery: Add an new block base code (https://github.com/woocommerce/woocommerce-blocks/pull/9937) 2023-07-03 14:21:31 +00:00
product-new Removed the second keyword (which previously denoted the text domain) from two blocks (https://github.com/woocommerce/woocommerce-blocks/pull/9816) 2023-06-21 14:30:57 +02:00
product-on-sale Convert Product On Sale block file from JS to TS (https://github.com/woocommerce/woocommerce-blocks/pull/9834) 2023-06-16 13:43:54 -03:00
product-query Products Block: fix grid view with Gutenberg 16 (https://github.com/woocommerce/woocommerce-blocks/pull/9916) 2023-06-20 14:12:30 +00:00
product-results-count Fixes CSS spacing and availability issues for breadcrumb, catalog sort, and result count blocks. (https://github.com/woocommerce/woocommerce-blocks/pull/8391) 2023-02-14 05:53:33 -05: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 Converted product-tag and removed its proptypes (https://github.com/woocommerce/woocommerce-blocks/pull/9758) 2023-07-03 10:54:46 +02:00
product-template Product Collection: Add columns control to product collection block editor settings (https://github.com/woocommerce/woocommerce-blocks/pull/9466) 2023-05-16 09:23:22 +00:00
product-top-rated Removed the second keyword (which previously denoted the text domain) from two blocks (https://github.com/woocommerce/woocommerce-blocks/pull/9816) 2023-06-21 14:30:57 +02:00
products Refactor: Convert All Products block file from Javascript to Typescript and replace propTypes with TypeScript definitions (https://github.com/woocommerce/woocommerce-blocks/pull/9802) 2023-06-16 12:48:47 -03:00
products-by-attribute Change the property name of the attribute slug in Products By Attribute after the refactor (https://github.com/woocommerce/woocommerce-blocks/pull/8759) 2023-03-15 12:29:13 +01:00
rating-filter Make filter by rating preview consistent with default settings (https://github.com/woocommerce/woocommerce-blocks/pull/10007) 2023-06-29 06:15:52 -07:00
reviews Fix PropType warning and error when adding All Reviews block to Editor (https://github.com/woocommerce/woocommerce-blocks/pull/9869) 2023-06-19 15:39:54 +05:30
shared/styles Add dropdown version of Filter by Rating (https://github.com/woocommerce/woocommerce-blocks/pull/7771) 2022-12-13 09:12:03 +01: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 Add back filter blocks frontend scripts (https://github.com/woocommerce/woocommerce-blocks/pull/9954) 2023-06-22 16:09:37 +02:00
store-notices Update the archive templates to use Products block (https://github.com/woocommerce/woocommerce-blocks/pull/8308)Co-authored-by: Alba Rincón <alba.rincon@automattic.com> 2023-02-22 08:24:04 +07: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.