woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Alba Rincón 3421857599 Fix stock filter placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/7009)
* Set max-height to avoid showing a big placeholder on longer titles

* Avoid showing placeholder when no there are no products

* Extract the placeholder to a separate component

* Adjust width

* Adjust border radius

* Pass the title to adjust the placeholder width/height

* Rename component
2022-08-31 10:43:26 +02:00
..
active-filters Layout Updates to Active Filters Block (https://github.com/woocommerce/woocommerce-blocks/pull/6905) 2022-08-26 09:11:23 -04:00
attribute-filter Fix z-index issue in Filter by Attribute dropdowns (https://github.com/woocommerce/woocommerce-blocks/pull/6981) 2022-08-25 13:55:33 +02:00
cart add side effect to package (https://github.com/woocommerce/woocommerce-blocks/pull/6904) 2022-08-16 16:21:26 +05:30
cart-checkout-shared Turn current page into the default Cart/Checkout page (https://github.com/woocommerce/woocommerce-blocks/pull/6867) 2022-08-29 09:35:05 +01:00
checkout Add _blank to terms link (https://github.com/woocommerce/woocommerce-blocks/pull/6908) 2022-08-16 15:59:21 +01:00
classic-template Show classic template in the inserter only for specific templates (https://github.com/woocommerce/woocommerce-blocks/pull/6539) 2022-06-29 09:42:02 +02:00
featured-items Select the correct inner button for the "Featured Item" button to update its url (https://github.com/woocommerce/woocommerce-blocks/pull/6741) 2022-07-26 14:30:18 +02:00
handpicked-products Upgrade wp-prettier to 2.6.2 and reformat the codebase (https://github.com/woocommerce/woocommerce-blocks/pull/6566) 2022-06-15 11:56:52 +02:00
mini-cart Add Style Attributes Hooks to blocks/hooks Directory. (https://github.com/woocommerce/woocommerce-blocks/pull/6870) 2022-08-10 20:04:12 -04:00
price-filter Remove the price filter setting label style (https://github.com/woocommerce/woocommerce-blocks/pull/6994) 2022-08-29 10:41:25 +02:00
product-best-sellers Start using `block.json` and convert to TS the `Product Best Sellers` block (https://github.com/woocommerce/woocommerce-blocks/pull/6683) 2022-07-20 11:29:49 +02:00
product-categories Add global styles to Product Categories List block in WC core (https://github.com/woocommerce/woocommerce-blocks/pull/6906) 2022-08-16 09:42:38 +02:00
product-category Start using `block.json` and convert to TS the `Product by Category` block (https://github.com/woocommerce/woocommerce-blocks/pull/6680) 2022-07-19 15:09:46 +02:00
product-new Remove custom `Icon` component in favour of `@wordpress/icons` where possible (https://github.com/woocommerce/woocommerce-blocks/pull/5599) 2022-02-01 16:54:38 +00:00
product-on-sale Remove custom `Icon` component in favour of `@wordpress/icons` where possible (https://github.com/woocommerce/woocommerce-blocks/pull/5599) 2022-02-01 16:54:38 +00:00
product-query Product Query Block POC (Phase 1) (https://github.com/woocommerce/woocommerce-blocks/pull/6812) 2022-08-18 10:02:21 +02:00
product-search Product search block as core/search variation (https://github.com/woocommerce/woocommerce-blocks/pull/6191) 2022-08-23 23:06:17 +07:00
product-tag Upgrade wp-prettier to 2.6.2 and reformat the codebase (https://github.com/woocommerce/woocommerce-blocks/pull/6566) 2022-06-15 11:56:52 +02:00
product-top-rated Remove custom `Icon` component in favour of `@wordpress/icons` where possible (https://github.com/woocommerce/woocommerce-blocks/pull/5599) 2022-02-01 16:54:38 +00:00
products All Products block: Migrate to block.json (https://github.com/woocommerce/woocommerce-blocks/pull/6754) 2022-07-28 12:26:36 +02:00
products-by-attribute Upgrade wp-prettier to 2.6.2 and reformat the codebase (https://github.com/woocommerce/woocommerce-blocks/pull/6566) 2022-06-15 11:56:52 +02:00
reviews Remove the ToggleButtonControl in favor of ToggleGroupControl (https://github.com/woocommerce/woocommerce-blocks/pull/5967) 2022-04-11 13:33:46 +02:00
single-product Update @woocmmerce/eslint-plugin to 2.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6203) 2022-04-08 14:47:19 +01:00
stock-filter Fix stock filter placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/7009) 2022-08-31 10:43:26 +02:00
README.md Format Markdown files using wp-scripts (https://github.com/woocommerce/woocommerce-blocks/pull/6462) 2022-06-09 14:43:17 +02: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.