woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Roy Ho 883d856c28 Add reset button in the editor for product attributer filter (https://github.com/woocommerce/woocommerce-blocks/pull/8285)
Co-authored-by: Niels Lange <info@nielslange.de>
2023-01-30 10:45:09 +01:00
..
active-filters Align text sizing in filter blocks: chips, checkboxes, buttons, dropdown (https://github.com/woocommerce/woocommerce-blocks/pull/7707) 2022-11-29 16:42:24 +01:00
attribute-filter Add reset button in the editor for product attributer filter (https://github.com/woocommerce/woocommerce-blocks/pull/8285) 2023-01-30 10:45:09 +01:00
breadcrumbs Create Store Breadcrumbs Block (https://github.com/woocommerce/woocommerce-blocks/pull/8222) 2023-01-27 18:31:13 +01:00
cart Expose cart errors as notices (https://github.com/woocommerce/woocommerce-blocks/pull/8162) 2023-01-19 16:40:52 +00:00
cart-checkout-shared Fix `useForcedLayout` to prevent breaking style book (https://github.com/woocommerce/woocommerce-blocks/pull/8243) 2023-01-27 11:45:49 +01:00
catalog-sorting Remove font family styling support from Catalog Sorting and Product Results Count blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8311) 2023-01-30 04:30:36 +01:00
checkout Make `Notice` component legible in dark themes (https://github.com/woocommerce/woocommerce-blocks/pull/8278) 2023-01-25 15:29:17 +01:00
classic-template Remove duplicated key from the object containing TEMPLATES in a test file (https://github.com/woocommerce/woocommerce-blocks/pull/8260) 2023-01-24 17:16:05 +01:00
customer-account Add `Customer account` to patterns (https://github.com/woocommerce/woocommerce-blocks/pull/7944) 2022-12-23 10:08:44 +01:00
featured-items Add border attributes to featured items block to show border styles in editor (https://github.com/woocommerce/woocommerce-blocks/pull/8304) 2023-01-27 12:29:39 -08: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 Refresh the cart when using the browser back button (https://github.com/woocommerce/woocommerce-blocks/pull/8236) 2023-01-25 16:28:41 +00:00
price-filter Hide blocks from Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8309) 2023-01-27 19:11:18 +01:00
product-best-sellers Set default orderby to popularity (https://github.com/woocommerce/woocommerce-blocks/pull/7025) 2022-08-31 12:38:48 +01:00
product-categories Improve public-facing texts and labels (https://github.com/woocommerce/woocommerce-blocks/pull/7045) 2022-09-12 10:39:26 +02:00
product-category Improve public-facing texts and labels (https://github.com/woocommerce/woocommerce-blocks/pull/7045) 2022-09-12 10:39:26 +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 Remove feature flag from Element variations (https://github.com/woocommerce/woocommerce-blocks/pull/8297) 2023-01-26 14:33:33 +01:00
product-results-count Remove font family styling support from Catalog Sorting and Product Results Count blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8311) 2023-01-30 04:30:36 +01:00
product-search Hide blocks from Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8309) 2023-01-27 19:11:18 +01:00
product-tag Improve public-facing texts and labels (https://github.com/woocommerce/woocommerce-blocks/pull/7045) 2022-09-12 10:39:26 +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 Move `StoreNoticesContainer` to `@woocommerce/blocks-checkout` package and add tests (https://github.com/woocommerce/woocommerce-blocks/pull/7558) 2022-11-17 05:33:58 -08:00
products-by-attribute Fix ESLint errors (https://github.com/woocommerce/woocommerce-blocks/pull/7556) 2022-11-02 17:46:14 +01:00
rating-filter Hide blocks from Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8309) 2023-01-27 19:11:18 +01:00
reviews Convert Reviews component to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7936) 2022-12-21 17:09:48 +04:00
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 Simplify @woocommerce/types imports (https://github.com/woocommerce/woocommerce-blocks/pull/8019) 2022-12-23 18:59:02 +07:00
stock-filter Hide blocks from Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8309) 2023-01-27 19:11:18 +01:00
store-notices Make `Notice` component legible in dark themes (https://github.com/woocommerce/woocommerce-blocks/pull/8278) 2023-01-25 15:29:17 +01: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.