Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Add border support to mini cart contents (#8654)
Browse files Browse the repository at this point in the history
* Add border support to mini cart contents

* Fix buttons in firefox when logged out

* Fix mini cart in all browsers

* Fix border not visible on mobile because of the admin bar

* Add feature flag to the experimental border

---------

Co-authored-by: Albert Juhé Lluveras <[email protected]>
  • Loading branch information
albarin and Aljullu authored Mar 10, 2023
1 parent 6736213 commit 0e7855c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
7 changes: 7 additions & 0 deletions assets/js/blocks/mini-cart/mini-cart-contents/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { cart, filledCart, removeCart } from '@woocommerce/icons';
import { Icon } from '@wordpress/icons';
import { registerBlockType } from '@wordpress/blocks';
import type { BlockConfiguration } from '@wordpress/blocks';
import { isFeaturePluginBuild } from '@woocommerce/block-settings';

/**
* Internal dependencies
Expand Down Expand Up @@ -41,6 +42,12 @@ const settings: BlockConfiguration = {
link: true,
},
lock: false,
...( isFeaturePluginBuild() && {
__experimentalBorder: {
color: true,
width: true,
},
} ),
},
attributes: {
isPreview: {
Expand Down
19 changes: 10 additions & 9 deletions assets/js/blocks/mini-cart/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@

.wp-block-woocommerce-mini-cart-contents {
box-sizing: border-box;
height: 100vh;
height: 100dvh;
max-height: -webkit-fill-available;
padding: 0;
justify-content: center;
}
Expand All @@ -99,9 +97,10 @@

.wp-block-woocommerce-empty-mini-cart-contents-block,
.wp-block-woocommerce-filled-mini-cart-contents-block {
height: 100vh;
height: 100dvh;
height: 100%;
max-height: -webkit-fill-available;
max-height: -moz-available;
max-height: fill-available;
display: flex;
flex-direction: column;
}
Expand Down Expand Up @@ -210,11 +209,13 @@ h2.wc-block-mini-cart__title {
}

.admin-bar .wp-block-woocommerce-mini-cart-contents {
margin-top: 32px;
margin-top: 46px;
height: calc(100dvh - 46px);
}

.admin-bar .wp-block-woocommerce-mini-cart-contents,
.admin-bar .wp-block-woocommerce-empty-mini-cart-contents-block,
.admin-bar .wp-block-woocommerce-filled-mini-cart-contents-block {
height: calc(100vh - 32px);
@media only screen and (min-width: 783px) {
.admin-bar .wp-block-woocommerce-mini-cart-contents {
margin-top: 32px;
height: calc(100dvh - 32px);
}
}

0 comments on commit 0e7855c

Please sign in to comment.