-
Notifications
You must be signed in to change notification settings - Fork 219
[Experimental] Mini Cart Icon Control via theme.json
.
#7491
Conversation
Refactor and/or abstract this to an external template, if...Refactor and/or abstract this to an external template, if that makes more sense.
woocommerce-blocks/src/BlockTypes/MiniCart.php Lines 399 to 410 in 68cde69
🚀 This comment was generated by the automations bot based on a
|
Determine if we need to update the inserter icon.Determine if we need to update the inserter icon. If so, we can abstract this out elsewhere because it is repeated in the block.
woocommerce-blocks/assets/js/blocks/mini-cart/index.tsx Lines 18 to 29 in 68cde69
🚀 This comment was generated by the automations bot based on a
|
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 |
Size Change: +1.9 kB (0%) Total Size: 1 MB
ℹ️ View Unchanged
|
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
Allow for a set of options for the Mini Cart icon that can be controlled via the theme.json file.
Note: We are currently using a Switch case in the main Mini Cart file. It may be nice, as a follow-up task, to refactor a little bit and abstract some of that template logic out.
It was noted at the meetup that, by changing the inserter icon, we run the risk of making it more confusing for the user when looking for the block in the editor. They are likely accustomed to seeing the icon as it is and would look for that familiar item when trying to add the block.
68cde69
to
52a1fb4
Compare
TypeScript Errors ReportFiles with errors: 448 🎉 🎉 This PR does not introduce new TS errors. |
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
Related to this issue #6868 |
This PR (as noted in the title) was more of an experiment to be served as a reference point, should we decide to pursue this route in the future. I am going to go ahead and close it out now, as it can still serve it's purpose as a reference while not being open. |
This is an experimental PR that allows control over the Mini Cart Icon via a theme's
theme.json
file.Test Plan
npm start
.settings
property in thetheme.json
file:icon
setting fromminiCartBasket
tominiCartBag
and confirm that the Mini Cart block now uses a bag icon.Note: This current implementation also updates the icon for the block in the inserter. We likely want to keep this icon the same, as it can potentially lead to confusion for what a user is looking for when adding a block in the editor. I've left it in here for the sake of experimentation, however.
To Do
settings/block/custom
or if it would be better to add a separate setting outside ofsettings
.