diff --git a/plugins/woocommerce-blocks/assets/css/editor.scss b/plugins/woocommerce-blocks/assets/css/editor.scss index 55a18b8b713..e187b37bd6a 100644 --- a/plugins/woocommerce-blocks/assets/css/editor.scss +++ b/plugins/woocommerce-blocks/assets/css/editor.scss @@ -19,29 +19,31 @@ flex-wrap: wrap; justify-content: flex-start; + &.components-placeholder { + padding: 2em 1em; + } + &.is-loading, - &.is-not-found, - &.cols-1 { + &.is-not-found { display: block; } - .wc-product-preview { - flex: 1; - padding: $gap/2; + &.cols-1 { + display: block; + + .wc-product-preview { + margin-left: auto; + margin-right: auto; + } } @for $i from 2 to 7 { &.cols-#{$i} .wc-product-preview { - max-width: calc(#{ 100% / $i }); - min-width: calc(#{ 100% / $i }); - flex: 1; + flex: 1 0 calc(#{ 100% / $i }); + max-width: 100% / $i !important; } } - &.components-placeholder { - padding: 2em 1em; - } - // Styles for "resuable block" preview. .editor-block-preview & { min-width: 5em; diff --git a/plugins/woocommerce-blocks/assets/js/components/product-preview/index.js b/plugins/woocommerce-blocks/assets/js/components/product-preview/index.js index 3fa5c930b44..38f84a627e7 100644 --- a/plugins/woocommerce-blocks/assets/js/components/product-preview/index.js +++ b/plugins/woocommerce-blocks/assets/js/components/product-preview/index.js @@ -13,13 +13,29 @@ import './style.scss'; * Display a preview for a given product. */ const ProductPreview = ( { product } ) => { - const { placeholderImgSrc } = wc_product_block_data; /* eslint-disable-line camelcase */ + const { + placeholderImgSrc, + } = wc_product_block_data; /* eslint-disable-line camelcase */ let image = null; if ( product.images.length ) { - image = ; + image = ( + + ); } else { - image = ; + image = ( + + ); } const rating = Number( product.average_rating ); @@ -29,7 +45,10 @@ const ProductPreview = ( { product } ) => { } return ( -