Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add Inner blocks to order summary #6065

Merged
merged 29 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a6e069a
Sub/Total/Fee inner blocks
mikejolley Mar 16, 2022
4240f52
Row blocks within the inner block
mikejolley Mar 17, 2022
c089588
Update icons
mikejolley Mar 17, 2022
fce5143
Resolve stying issues
mikejolley Mar 17, 2022
ef752e3
Remove old block
mikejolley Mar 18, 2022
58c41ad
Pin totals row
mikejolley Mar 18, 2022
1fef92d
Locking logic update
mikejolley Mar 18, 2022
4a5bf74
Heading inner block
mikejolley Mar 18, 2022
f049f47
Refactor where inner blocks are defined
mikejolley Mar 18, 2022
e1d8962
Add todos
mikejolley Mar 18, 2022
f4fdfc0
Todo for Consider deprecating OrderMetaSlotFill and DiscountSlotFill …
mikejolley Mar 18, 2022
807ac42
Improve frontend registration of components using new entrypoint
mikejolley Mar 21, 2022
0bfe5cf
Experiment- external block context
mikejolley Mar 21, 2022
f88c680
Revert "Experiment- external block context"
mikejolley Mar 21, 2022
c28ad41
Duplicate inner blocks to avoid conflicts with context
mikejolley Mar 21, 2022
6e012e3
Remove todo
mikejolley Mar 21, 2022
23fe5e1
Rename block dir
mikejolley Mar 21, 2022
6f291f5
Some test fixes
mikejolley Mar 21, 2022
614ec92
Fix import
mikejolley Mar 22, 2022
3a4ba59
fix import
mikejolley Mar 22, 2022
36415b6
linting
mikejolley Mar 22, 2022
217def8
Remove unused attributes
mikejolley Mar 22, 2022
7c9af1b
Optional classname
mikejolley Mar 22, 2022
03e804c
fix coupons import
senadir Mar 22, 2022
ff09db0
fix shipping mocks
senadir Mar 22, 2022
f07710f
Styling
mikejolley Mar 22, 2022
2ce7720
Fix selectors in e2e tests
mikejolley Mar 22, 2022
1067039
Add back the wc-block-components-totals-wrapper class that was used f…
ralucaStan Mar 31, 2022
d654f5b
Reuse the TotalsWrapper component for C& C blocks inner blocks
ralucaStan Apr 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,3 @@
content: ", ";
white-space: pre;
}

// Target the shipping selection in checkout only, the Cart block has enough spacing because of the buttons on the panel.
.wc-block-checkout .wc-block-components-shipping-rates-control__package {
margin-bottom: em($gap-large);

&:last-of-type {
margin-bottom: 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import classNames from 'classnames';
import { createInterpolateElement } from '@wordpress/element';
import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount';
import {
Expand Down Expand Up @@ -30,6 +31,7 @@ export interface TotalsFooterItemProps {
* convenience, but will use only these two properties.
*/
values: LooselyMustHave< CartResponseTotals, 'total_price' | 'total_tax' >;
className?: string;
}

/**
Expand All @@ -42,6 +44,7 @@ export interface TotalsFooterItemProps {
const TotalsFooterItem = ( {
currency,
values,
className,
}: TotalsFooterItemProps ): JSX.Element => {
const SHOW_TAXES =
getSetting< boolean >( 'taxesEnabled', true ) &&
Expand All @@ -64,7 +67,10 @@ const TotalsFooterItem = ( {

return (
<TotalsItem
className="wc-block-components-totals-footer-item"
className={ classNames(
'wc-block-components-totals-footer-item',
className
) }
currency={ currency }
label={ label }
value={ parseInt( totalPrice, 10 ) }
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import classNames from 'classnames';
/**
* Internal dependencies
*/
import CartLineItemsTable from '../../../cart/cart-line-items-table';
import CartLineItemsTable from '../../../../cart/cart-line-items-table';

type MiniCartContentsBlockProps = {
className: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ import { Icon } from '@wordpress/icons';
/**
* Internal dependencies
*/
import './inner-blocks';
import './editor.scss';
import {
addClassToBody,
useViewSwitcher,
useBlockPropsWithLocking,
useForcedLayout,
} from '../shared';
} from '../cart-checkout/shared';
import { CartBlockContext } from './context';

// This is adds a class to body to signal if the selected block is locked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ body.wc-lock-selected-block--remove {
position: relative;
}
}

.wp-block-woocommerce-cart-order-summary-block {
.block-editor-block-list__layout > div {
margin: 0 !important;
}

.wc-block-components-totals-wrapper {
box-sizing: border-box;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we had the .wc-block-components-totals-wrapper class for each item of the summary.
Now:

  • we use the .wc-block-components-totals-wrapper class only for slots
  • we have .wc-block-components-totals-item for some of the items
  • summary, coupon and shipping don't have the .wc-block-components-totals-item and it needs to be styled separately.

I think it was good to have one class for each of this summary items. I wonder why:

  • we didn't keep the .wc-block-components-totals-wrapper?
  • we don't add .wc-block-components-totals-item to coupon, summary and shipping as well?

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ const settings = {
);
},
migrate: ( attributes, innerBlocks ) => {
const {
isShippingCalculatorEnabled,
showRateAfterTaxName,
checkoutPageId,
align,
} = attributes;
const { checkoutPageId, align } = attributes;
return [
attributes,
[
Expand All @@ -83,10 +78,7 @@ const settings = {
[
createBlock(
'woocommerce/cart-order-summary-block',
{
isShippingCalculatorEnabled,
showRateAfterTaxName,
}
{}
),
createBlock(
'woocommerce/cart-express-payment-block'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import classnames from 'classnames';
/**
* Internal dependencies
*/
import { CartExpressPayment } from '../../../payment-methods';
import { CartExpressPayment } from '../../../cart-checkout/payment-methods';

const Block = ( { className }: { className: string } ): JSX.Element | null => {
const { cartNeedsPayment } = useStoreCart();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Internal dependencies
*/
import Block from './block';

export default Block;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import type { TemplateArray } from '@wordpress/blocks';
/**
* Internal dependencies
*/
import { useForcedLayout, getAllowedBlocks } from '../../../shared';
import {
useForcedLayout,
getAllowedBlocks,
} from '../../../cart-checkout/shared';

export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {
const blockProps = useBlockProps( { className: 'wc-block-cart__main' } );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Internal dependencies
*/
import Block from './block';

export default Block;
Loading