woocommerce/plugins/woocommerce-blocks/assets/js/blocks
Alex Florisca 7dc8dd63ba
Update Order Summary Design (#45767)
* Add border around order summary on cart & checkout

* Group subtotal, discount, fees, taxes and shiping block

* Move the coupon form in order summary

* Move the coupon form in order summary

* Manage state externally in Panel component and refactor Coupon form to use the Panel component

* Remove descriptions from order summary items

* increase font weight of order summary title

* Tidy up design for desktop and add separator back in for blocks on checkout order summary

* Remove border around order summary on mobile

* Revert "Move the coupon form in order summary"

This reverts commit 4a8044cdcf.

* Change heading styles for cart

* Change font weight to 500 of order summary heading on checkout block

* Remove padding and border between order summary totals items

* Refactor css for cart & checkout totals to work in the editor

* Adjust cart totals heading in the editor

* Last adjustment to checkout totals style to work in editor

* Add changelog

* Change the cursor to pointer for the panel component

* remove unused short and full description from OrderSummaryItem

* Fix failing e2e tests

* Fix lint issues

* Vertically align order summary title in the editor

* Fix e2e tests

* Fix linting issues

* Fix unit tests

* Remove changes from woocommerce.php

* Fix checkout block test

* fix eslint errors in checkout block test

---------

Co-authored-by: Niels Lange <info@nielslange.de>
2024-04-25 12:03:31 +07:00
..
active-filters Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
attribute-filter Add translation context to ambiguous words (#46382) 2024-04-10 06:17:14 -07:00
breadcrumbs Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
cart Update Order Summary Design (#45767) 2024-04-25 12:03:31 +07:00
cart-checkout-shared Adding support for co-branded credit cards (#45903) 2024-04-15 22:59:05 +01:00
catalog-sorting Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
checkout Update Order Summary Design (#45767) 2024-04-25 12:03:31 +07:00
classic-shortcode Update Woo.com references to WooCommerce.com (#46259) 2024-04-09 09:50:15 +01:00
classic-template Update @woo.com email addresses to @woocommerce.com (#46387) 2024-04-19 21:11:01 +00:00
coming-soon [LYS] Reapply styles from 46619 (#46813) 2024-04-23 19:26:35 +12:00
customer-account Customer Account block: Remove margin-left from label (#45934) 2024-03-27 10:24:11 +00:00
featured-items Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
filter-wrapper [Experimental] Filter block: replace custom upgrade panel by Transforms API (#44024) 2024-01-25 15:28:09 +07:00
handpicked-products Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08: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 price disappearing on hover (#43550) 2024-01-12 13:39:34 +01:00
order-confirmation Graduate Additional Fields to stable and rename it. (#46805) 2024-04-23 16:47:32 +02:00
page-content-wrapper update text domain in plugins/woocommerce-blocks (#42717) 2023-12-12 14:12:36 -08:00
price-filter Update Woo.com references to WooCommerce.com (#46259) 2024-04-09 09:50:15 +01:00
product-best-sellers Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
product-categories Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
product-category Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
product-collection Product Collection: break taxonomies filter into multiple menu items per each taxonomy (#46160) 2024-04-11 08:13:42 +02:00
product-filter Add translation context to ambiguous words (#46382) 2024-04-10 06:17:14 -07:00
product-gallery Product Gallery block: Add logic to trap keyboard focus within the Product Gallery Pop-Up (#44439) 2024-02-09 13:43:51 -03:00
product-new Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
product-on-sale Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
product-query Remove padding for the products query when background is added (#42817) 2023-12-18 11:14:43 +01:00
product-results-count Added Result Count Client Navigation (#45556) 2024-03-14 09:48:02 -07:00
product-search Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
product-tag Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
product-template Rename the "other" location from `generic` to `site` (#46228) 2024-04-05 15:54:56 +02:00
product-top-rated Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
products Update Woo.com references to WooCommerce.com (#46259) 2024-04-09 09:50:15 +01:00
products-by-attribute Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
rating-filter Add translation context to ambiguous words (#46382) 2024-04-10 06:17:14 -07:00
reviews Reviews by Product > No Reviews Placeholder: Refactor component from JavaScript to TypeScript (#44664) 2024-02-22 22:23:53 -03: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 Single Product Block: Add missing allowed inner blocks to fix nesting placement restrictions (#45530) 2024-03-25 10:59:57 -03:00
stock-filter Add translation context to ambiguous words (#46382) 2024-04-10 06:17:14 -07:00
store-notices update text domain in plugins/woocommerce-blocks (#42717) 2023-12-12 14:12:36 -08: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.