From 1fddb9451da88fba6fe8c1a0d9b18c626bd509c0 Mon Sep 17 00:00:00 2001 From: Seghir Nadir Date: Thu, 13 Aug 2020 14:24:51 +0100 Subject: [PATCH] Use real previews for the Cart and Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/2992) * Use real previews for the cart and checkout * remove extra files and css --- .../assets/img/cart-preview.svg | 20 ------------------- .../assets/img/checkout-preview.svg | 20 ------------------- .../js/blocks/cart-checkout/cart/edit.js | 13 ++++++------ .../js/blocks/cart-checkout/cart/editor.scss | 5 +++++ .../js/blocks/cart-checkout/checkout/edit.js | 17 +++++++++------- .../blocks/cart-checkout/checkout/editor.scss | 5 +++++ .../assets/js/previews/cart-block.js | 16 --------------- .../assets/js/previews/checkout-block.js | 16 --------------- .../assets/js/previews/index.js | 2 -- 9 files changed, 27 insertions(+), 87 deletions(-) delete mode 100644 plugins/woocommerce-blocks/assets/img/cart-preview.svg delete mode 100644 plugins/woocommerce-blocks/assets/img/checkout-preview.svg delete mode 100644 plugins/woocommerce-blocks/assets/js/previews/cart-block.js delete mode 100644 plugins/woocommerce-blocks/assets/js/previews/checkout-block.js diff --git a/plugins/woocommerce-blocks/assets/img/cart-preview.svg b/plugins/woocommerce-blocks/assets/img/cart-preview.svg deleted file mode 100644 index bf40f4ca3f0..00000000000 --- a/plugins/woocommerce-blocks/assets/img/cart-preview.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/woocommerce-blocks/assets/img/checkout-preview.svg b/plugins/woocommerce-blocks/assets/img/checkout-preview.svg deleted file mode 100644 index 790fb7dfe07..00000000000 --- a/plugins/woocommerce-blocks/assets/img/checkout-preview.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/edit.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/edit.js index 58e7845a1bf..b1efab5ce63 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/edit.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/edit.js @@ -1,6 +1,7 @@ /** * External dependencies */ +import classnames from 'classnames'; import { __ } from '@wordpress/i18n'; import { CartCheckoutFeedbackPrompt } from '@woocommerce/block-components/feedback-prompt'; import { InspectorControls } from '@wordpress/block-editor'; @@ -23,7 +24,7 @@ import { import { __experimentalCreateInterpolateElement } from 'wordpress-element'; import { useRef } from '@wordpress/element'; import { getAdminLink } from '@woocommerce/settings'; -import { previewCart, cartBlockPreview } from '@woocommerce/resource-previews'; +import { previewCart } from '@woocommerce/resource-previews'; /** * Internal dependencies @@ -143,12 +144,12 @@ const BlockSettings = ( { attributes, setAttributes } ) => { * in the frontend. */ const CartEditor = ( { className, attributes, setAttributes } ) => { - if ( attributes.isPreview ) { - return cartBlockPreview; - } - return ( -
+
{ const CheckoutEditor = ( { attributes, setAttributes } ) => { const { className, isPreview } = attributes; - - if ( isPreview ) { - return checkoutBlockPreview; - } - return ( -
+
-); diff --git a/plugins/woocommerce-blocks/assets/js/previews/checkout-block.js b/plugins/woocommerce-blocks/assets/js/previews/checkout-block.js deleted file mode 100644 index b3e7d62e608..00000000000 --- a/plugins/woocommerce-blocks/assets/js/previews/checkout-block.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * External dependencies - */ -import { WC_BLOCKS_ASSET_URL } from '@woocommerce/block-settings'; - -export const checkoutBlockPreview = ( - -); diff --git a/plugins/woocommerce-blocks/assets/js/previews/index.js b/plugins/woocommerce-blocks/assets/js/previews/index.js index 923569598b5..c64cd463cd8 100644 --- a/plugins/woocommerce-blocks/assets/js/previews/index.js +++ b/plugins/woocommerce-blocks/assets/js/previews/index.js @@ -5,7 +5,5 @@ export { previewCategories } from './categories'; export { previewShippingRates } from './shipping-rates'; export { previewSavedPaymentMethods } from './saved-payment-methods'; -export { cartBlockPreview } from './cart-block'; -export { checkoutBlockPreview } from './checkout-block'; export { gridBlockPreview } from './grid-block'; export { singleProductBlockPreview } from './single-product-block';