woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Mike Jolley 3c830d6f3f
Add/cart link in checkout header 44837 (#51948)
* Cart Link Block WIP

* Add pattern for header

* changelog

* We added a header so update test

* Add wc-blocks-header-pattern class

* render_woocommerce_template_part was missing wrappers

* Add missing class

* Update plugins/woocommerce/src/Blocks/BlockTypes/CartLink.php

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Update plugins/woocommerce/src/Blocks/BlockTypes/CartLink.php

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Update plugins/woocommerce/src/Blocks/BlockTypes/CartLink.php

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Further SVG compression

* Remove unnecessary area handling

* Shared icon with mini cart

* Global style support

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2024-10-17 16:50:12 +01:00
..
active-filters Fix: React error in filter blocks due to duplicated renders (#51840) 2024-10-02 19:20:10 +07:00
attribute-filter Fix: React error in filter blocks due to duplicated renders (#51840) 2024-10-02 19:20:10 +07:00
breadcrumbs Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
cart Fix visual inconsisties in Cart/Checkout between elements and between Light/Dark modes (#51585) 2024-09-23 14:11:43 +02:00
cart-checkout-shared Fix visual inconsisties in Cart/Checkout between elements and between Light/Dark modes (#51585) 2024-09-23 14:11:43 +02:00
cart-link Add/cart link in checkout header 44837 (#51948) 2024-10-17 16:50:12 +01:00
catalog-sorting Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
checkout Fix visual inconsisties in Cart/Checkout between elements and between Light/Dark modes (#51585) 2024-09-23 14:11:43 +02:00
classic-shortcode Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
classic-template Update broken docs links (#51967) 2024-10-10 17:37:27 +01:00
coming-soon Fix size for coming soon banner login button (#51251) 2024-09-11 13:47:02 +08:00
customer-account Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
featured-items Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
filter-wrapper Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
handpicked-products Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
migration-products-to-product-collection Product Collection: Remove automatic migration code (#50440) 2024-08-13 11:29:07 +02:00
mini-cart Add/cart link in checkout header 44837 (#51948) 2024-10-17 16:50:12 +01:00
order-confirmation Delayed Account Creation Test Coverage (#51852) 2024-10-07 11:12:37 +01:00
page-content-wrapper Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
price-filter Fix: React error in filter blocks due to duplicated renders (#51840) 2024-10-02 19:20:10 +07:00
product-best-sellers Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
product-categories Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
product-category Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
product-collection Product Collection: Remove best selling filter option (#51865) 2024-10-06 11:53:27 -05:00
product-elements/add-to-cart-form Add to Cart with Options: Add Stepper option (#48876) 2024-10-10 16:36:49 +02:00
product-filters [Experimental] Product filters/remove template parts (#52041) 2024-10-16 14:02:25 -07:00
product-gallery Fix fatal when adding the Product Gallery (Beta) block into a pattern (#51189) 2024-09-17 09:49:53 +02:00
product-new Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
product-on-sale Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
product-query Hide Products (Beta) from inserter (#48204) 2024-06-12 15:45:27 +02:00
product-results-count Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
product-search Add inspector controls to Product Search block (#51247) 2024-09-13 18:52:12 -03:00
product-tag Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
product-template Product Collection: Implement the Hand-Picked collection (#51141) 2024-09-21 20:10:10 +05:30
product-top-rated Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
products Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
products-by-attribute Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00:00
rating-filter Fix: React error in filter blocks due to duplicated renders (#51840) 2024-10-02 19:20:10 +07:00
reviews Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00: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 Deprecate single product block save (#51153) 2024-09-11 09:54:43 -03:00
stock-filter Fix: React error in filter blocks due to duplicated renders (#51840) 2024-10-02 19:20:10 +07:00
store-notices Update all blocks to V3 (#48720) 2024-08-20 10:14:11 +00: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.