* move shipping-rates-control and shipping totals back into base/components/cart-checkout

* fix notice styling

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
This commit is contained in:
Darren Ethier 2021-02-03 06:35:17 -05:00 committed by GitHub
parent 6c3fe9e820
commit b991486a84
14 changed files with 17 additions and 23 deletions

View File

@ -13,6 +13,7 @@ export { default as ProductSaleBadge } from './product-sale-badge';
export { default as ReturnToCartButton } from './return-to-cart-button'; export { default as ReturnToCartButton } from './return-to-cart-button';
export { default as ShippingCalculator } from './shipping-calculator'; export { default as ShippingCalculator } from './shipping-calculator';
export { default as ShippingLocation } from './shipping-location'; export { default as ShippingLocation } from './shipping-location';
export { default as ShippingRatesControl } from './shipping-rates-control';
export { default as PaymentMethodIcons } from './payment-method-icons'; export { default as PaymentMethodIcons } from './payment-method-icons';
export { default as PaymentMethodLabel } from './payment-method-label'; export { default as PaymentMethodLabel } from './payment-method-label';
export * from './totals'; export * from './totals';

View File

@ -6,18 +6,15 @@ import { useEffect } from '@wordpress/element';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { speak } from '@wordpress/a11y'; import { speak } from '@wordpress/a11y';
import LoadingMask from '@woocommerce/base-components/loading-mask'; import LoadingMask from '@woocommerce/base-components/loading-mask';
import {
ShippingRatesControlPackage,
ExperimentalOrderShippingPackages,
} from '@woocommerce/blocks-checkout';
import { import {
getShippingRatesPackageCount, getShippingRatesPackageCount,
getShippingRatesRateCount, getShippingRatesRateCount,
} from '@woocommerce/base-utils'; } from '@woocommerce/base-utils';
/**
* Internal dependencies
*/
import Package from './package';
import ExperimentalOrderShippingPackages from '../../order-shipping-packages';
import './style.scss';
/** /**
* @typedef {import('react')} React * @typedef {import('react')} React
*/ */
@ -25,9 +22,6 @@ import './style.scss';
/** /**
* Renders the shipping rates control element. * Renders the shipping rates control element.
* *
* @todo Move ShippingRatesControl, TotalsShipping, and ShippingRateSelector to our base components folder.
* they're too coupled with our base implementation to be exported and we should only export Package.
*
* @param {Object} props Incoming props. * @param {Object} props Incoming props.
* @param {Array} props.shippingRates Array of packages containing shipping rates. * @param {Array} props.shippingRates Array of packages containing shipping rates.
* @param {boolean} props.shippingRatesLoading True when rates are being loaded. * @param {boolean} props.shippingRatesLoading True when rates are being loaded.
@ -141,7 +135,7 @@ const Packages = ( {
} }
return packages.map( ( { package_id: packageId, ...packageData } ) => ( return packages.map( ( { package_id: packageId, ...packageData } ) => (
<Package <ShippingRatesControlPackage
key={ packageId } key={ packageId }
packageId={ packageId } packageId={ packageId }
packageData={ packageData } packageData={ packageData }

View File

@ -1,3 +1,4 @@
export { default as TotalsCoupon } from './coupon'; export { default as TotalsCoupon } from './coupon';
export { default as TotalsDiscount } from './discount'; export { default as TotalsDiscount } from './discount';
export { default as TotalsFooterItem } from './footer-item'; export { default as TotalsFooterItem } from './footer-item';
export { default as TotalsShipping } from './shipping';

View File

@ -11,11 +11,11 @@ import {
ShippingCalculator, ShippingCalculator,
ShippingLocation, ShippingLocation,
} from '@woocommerce/base-components/cart-checkout'; } from '@woocommerce/base-components/cart-checkout';
import { TotalsItem } from '@woocommerce/blocks-checkout';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import TotalsItem from '../item';
import ShippingRateSelector from './shipping-rate-selector'; import ShippingRateSelector from './shipping-rate-selector';
import hasShippingRate from './has-shipping-rate'; import hasShippingRate from './has-shipping-rate';
import './style.scss'; import './style.scss';

View File

@ -8,7 +8,7 @@ import classnames from 'classnames';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { ShippingRatesControl } from '../../shipping'; import ShippingRatesControl from '../../shipping-rates-control';
const ShippingRateSelector = ( { const ShippingRateSelector = ( {
hasRates, hasRates,

View File

@ -8,12 +8,12 @@ import {
TotalsCoupon, TotalsCoupon,
TotalsDiscount, TotalsDiscount,
TotalsFooterItem, TotalsFooterItem,
TotalsShipping,
} from '@woocommerce/base-components/cart-checkout'; } from '@woocommerce/base-components/cart-checkout';
import { import {
Subtotal, Subtotal,
TotalsFees, TotalsFees,
TotalsTaxes, TotalsTaxes,
TotalsShipping,
ExperimentalOrderMeta, ExperimentalOrderMeta,
getCurrencyFromPriceResponse, getCurrencyFromPriceResponse,
} from '@woocommerce/blocks-checkout'; } from '@woocommerce/blocks-checkout';

View File

@ -2,15 +2,15 @@
* External dependencies * External dependencies
*/ */
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { FormStep } from '@woocommerce/base-components/cart-checkout'; import {
FormStep,
ShippingRatesControl,
} from '@woocommerce/base-components/cart-checkout';
import { import {
getShippingRatesPackageCount, getShippingRatesPackageCount,
getShippingRatesRateCount, getShippingRatesRateCount,
} from '@woocommerce/base-utils'; } from '@woocommerce/base-utils';
import { import { getCurrencyFromPriceResponse } from '@woocommerce/blocks-checkout';
getCurrencyFromPriceResponse,
ShippingRatesControl,
} from '@woocommerce/blocks-checkout';
import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount';
import { import {
useCheckoutContext, useCheckoutContext,

View File

@ -6,12 +6,12 @@ import {
TotalsCoupon, TotalsCoupon,
TotalsDiscount, TotalsDiscount,
TotalsFooterItem, TotalsFooterItem,
TotalsShipping,
} from '@woocommerce/base-components/cart-checkout'; } from '@woocommerce/base-components/cart-checkout';
import { import {
Subtotal, Subtotal,
TotalsFees, TotalsFees,
TotalsTaxes, TotalsTaxes,
TotalsShipping,
ExperimentalOrderMeta, ExperimentalOrderMeta,
getCurrencyFromPriceResponse, getCurrencyFromPriceResponse,
} from '@woocommerce/blocks-checkout'; } from '@woocommerce/blocks-checkout';

View File

@ -1,2 +1 @@
export { default as ShippingRatesControl } from './shipping-rates-control';
export { default as ShippingRatesControlPackage } from './package'; export { default as ShippingRatesControlPackage } from './package';

View File

@ -24,7 +24,7 @@
white-space: pre; white-space: pre;
} }
.components-notice.wc-block-components-shipping-rates-control__no-results-notice { .wc-block-checkout__shipping-option .wc-block-components-shipping-rates-control__no-results-notice {
margin-bottom: 0; margin-bottom: 0;
} }

View File

@ -1,5 +1,4 @@
export { default as TotalsItem } from './item'; export { default as TotalsItem } from './item';
export { default as Subtotal } from './subtotal'; export { default as Subtotal } from './subtotal';
export { default as TotalsTaxes } from './taxes'; export { default as TotalsTaxes } from './taxes';
export { default as TotalsShipping } from './shipping';
export { default as TotalsFees } from './fees'; export { default as TotalsFees } from './fees';