woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Karol Manijak 955332941e Translate Related Products heading in Single Product template (https://github.com/woocommerce/woocommerce-blocks/pull/11693)
* Create Related Products pattern reused in the Single Product template

That's needed in order to make the Related Products string translatable

* Add margin to Related Products heading

* Add margin to Related Products transformed from classic template

* Simplify the translation

* Change string capitalization so it's the same as the other one and can be transklated
2023-11-09 09:00:23 +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 Move `CheckboxList` and create new `blocksComponents` package (https://github.com/woocommerce/woocommerce-blocks/pull/11214) 2023-10-17 02:47:34 -07: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 Cart and Checkout block transforms for classic shortcodes (https://github.com/woocommerce/woocommerce-blocks/pull/11228) 2023-10-19 16:43:43 +01:00
cart-checkout-shared Move `Title` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11383) 2023-11-01 03:40:29 -07:00
catalog-sorting Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831) 2023-07-04 13:06:48 +02:00
checkout Add back missing render-checkout-form hook (https://github.com/woocommerce/woocommerce-blocks/pull/11554) 2023-11-03 16:30:40 +00: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 Cart and Checkout block transforms for classic shortcodes (https://github.com/woocommerce/woocommerce-blocks/pull/11228) 2023-10-19 16:43:43 +01:00
collection-filters Collection Filters refactor: data fetching, context passing, and code organization (https://github.com/woocommerce/woocommerce-blocks/pull/11476) 2023-11-07 14:55:23 +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 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 Fix: Mini-Cart block shows wrong total if theres multiple installs on the same domain (https://github.com/woocommerce/woocommerce-blocks/pull/11257) 2023-10-18 07:21:15 +00:00
order-confirmation Add universal border radius for form elements and components (https://github.com/woocommerce/woocommerce-blocks/pull/11193) 2023-10-11 17:04:45 +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 Add universal border radius for form elements and components (https://github.com/woocommerce/woocommerce-blocks/pull/11193) 2023-10-11 17:04:45 +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 Fix wcSettings inconsistent property naming style (https://github.com/woocommerce/woocommerce-blocks/pull/10439) 2023-08-07 11:30:53 +01:00
product-collection Product Collection: Add support for filtering products by featured status (https://github.com/woocommerce/woocommerce-blocks/pull/11522) 2023-11-08 15:37:32 +05:30
product-gallery Product Gallery block: Disable zoom when hovering the Next/Previous buttons (https://github.com/woocommerce/woocommerce-blocks/pull/11538) 2023-11-07 12:34:41 -03: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 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 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 Remove authors filter from Product Collection block (https://github.com/woocommerce/woocommerce-blocks/pull/11427) 2023-10-25 19:11:56 +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 Revert woocommerce/woocommerce-blocks#10032 so All Products renders in the frontend (https://github.com/woocommerce/woocommerce-blocks/pull/11263) 2023-10-16 17:16:07 +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 Filter By Rating: fix overlapping stars (https://github.com/woocommerce/woocommerce-blocks/pull/11644) 2023-11-07 10:59:36 +00:00
reviews Move `SortSelect` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11411) 2023-10-26 04:55:34 -07: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 Pattern: fetch product id on the JS side (https://github.com/woocommerce/woocommerce-blocks/pull/11138) 2023-10-05 07:30:50 +00: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 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.