-
Notifications
You must be signed in to change notification settings - Fork 219
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx |
Size Change: -59.4 kB (-5%) ✅ Total Size: 1.06 MB
ℹ️ View Unchanged
|
239c946
to
3256614
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is overall working well, thanks for working on this, @albarin! I noticed one issue that should be fixed, though. To reproduce: make some edits to the button texts in trunk
, then, check out this branch and build. If you go to the frontend, you will see the buttons are not displayed at all (as the new Mini Cart footer block only renders inner blocks, but in the saved template there are no inner blocks!):
In the editor, the buttons are displayed, but the text modifications that were done are lost.
I'm not sure, but we might need to add a deprecation to make the legacy mode 'transition' to the new one?
Besides that, a minor one: we should preload the new frontend scripts: https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/BlockTypes/MiniCart.php#L276-L283. (I wonder if there is a way to make it simpler, so every time we create a new block we don't need to add it to this list 🤔 )
...s/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-checkout-button-block/block.tsx
Outdated
Show resolved
Hide resolved
.../blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-checkout-button-block/block.json
Outdated
Show resolved
Hide resolved
...s/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-cart-button-block/block.json
Outdated
Show resolved
Hide resolved
Ouch, great catch 👌 I'll explore if we can use the deprecation thing to fix this. |
@Aljullu could you have another look? I think I fixed the issue using the block deprecation approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is shaping up nicely. Overall the deprecation works well, but I found some edge cases.
If the theme has a custom template part for the Mini Cart, I think the deprecation is not running (so the same issue happens; no buttons in the frontend). You can reproduce as follows:
- Add a
/parts/mini-cart.html
file to your block theme with the contents of the previous Mini Cart template part. - Go to the frontend, the buttons are not visible.
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/index.tsx
Outdated
Show resolved
Hide resolved
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx
Outdated
Show resolved
Hide resolved
@Aljullu I've changed the migrate function and the way children/buttons are rendered. I'm not particularly fond of the way to check if there are children, but I haven't been able to find another way so far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the migrate function and the way children/buttons are rendered. I'm not particularly fond of the way to check if there are children, but I haven't been able to find another way so far.
Yeah... I have been for some hours running in circles trying different approaches but couldn't find a better one. We will probably hit the same problem in #6259 and in any other issue where we want to break blocks into smaller pieces.
I think it's ok for now and we can iterate on it later if we find a better approach. I left some comments below, but pre-approving. Good job, @albarin, this issue was a tricky one!
...ts/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-cart-button-block/block.tsx
Outdated
Show resolved
Hide resolved
...s/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-checkout-button-block/block.tsx
Outdated
Show resolved
Hide resolved
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Albert Juhé Lluveras <[email protected]>
This PR converts the
View my cart
andGo to checkout
buttons to inner blocks and adds the ability to style them.Fixes #8736
Testing
Automated Tests
User Facing Testing
Mini cart
block to the header template of your site.Site Editor
and edit theMini cart
template part.List view
and select theFilled Mini Cart view
.View my cart
button and check that you can change the background and text colors of the button.Go to checkout
button and check that you can change the background and text colors of the button.WooCommerce Visibility
Changelog