woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Karol Manijak 67dbd22dfe Fix incorrect filter application in Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10263)
* Fix the incorrectly applied filter in Product Collection

* Get the block name from metadata
2023-07-19 11:15:37 +02:00
..
active-filters Enable declaration-block-no-duplicate-properties stylelint rule (https://github.com/woocommerce/woocommerce-blocks/pull/10163) 2023-07-11 13:03:05 +00:00
attribute-filter Stop reading Product IDs from asset store in filter blocks (https://github.com/woocommerce/woocommerce-blocks/pull/10195) 2023-07-14 11:18:10 +02:00
breadcrumbs Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
cart Fix margin issue with the Proceed to checkout button on the site editor (https://github.com/woocommerce/woocommerce-blocks/pull/10182) 2023-07-12 15:28:37 +01:00
cart-checkout-shared Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
catalog-sorting Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
checkout Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02: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 Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02: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 Create Mini-Cart template part area (https://github.com/woocommerce/woocommerce-blocks/pull/10203) 2023-07-18 09:12:43 +02:00
price-filter Stop reading Product IDs from asset store in filter blocks (https://github.com/woocommerce/woocommerce-blocks/pull/10195) 2023-07-14 11:18:10 +02: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 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/you do not need lodash (https://github.com/woocommerce/woocommerce-blocks/pull/9161) 2023-04-28 11:29:45 +01:00
product-collection Fix incorrect filter application in Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10263) 2023-07-19 11:15:37 +02:00
product-gallery Product Gallery: Add Large Image inner block (https://github.com/woocommerce/woocommerce-blocks/pull/10045) 2023-07-06 15:08:39 +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 Automatic migration path from Products to Product Collection - step 1 - automatic migration (https://github.com/woocommerce/woocommerce-blocks/pull/10115) 2023-07-12 10:01:36 +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 Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
product-template Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02: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 Fix filter count display toggle (https://github.com/woocommerce/woocommerce-blocks/pull/10096) 2023-07-05 08:51:02 +02: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 Automatic migration path from Products to Product Collection - step 3 - allow reverting migration (https://github.com/woocommerce/woocommerce-blocks/pull/10144) 2023-07-12 17:01:49 +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 Stop reading Product IDs from asset store in filter blocks (https://github.com/woocommerce/woocommerce-blocks/pull/10195) 2023-07-14 11:18:10 +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.