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

Fix Cart and Checkout sidebar styling issues #2694

Merged
merged 9 commits into from Jun 12, 2020
Expand Up @@ -36,7 +36,6 @@
}

.wc-block-checkout-step__title {
line-height: 1.5;
margin: 0 $gap-small 0 0;
}

Expand Down
@@ -1,5 +1,8 @@
.wc-block-components-order-summary {
border: 0;
.wc-blocks-components-panel__button {
margin-top: 0;
padding-top: 0;
}
}

.wc-block-components-order-summary__content {
Expand Down
Expand Up @@ -18,6 +18,7 @@ const ProductMetadata = ( {
return (
<div className="wc-block-product-metadata">
<ProductSummary
className="wc-block-product-description"
shortDescription={ shortDescription }
fullDescription={ fullDescription }
/>
Expand Down
Expand Up @@ -2,7 +2,7 @@
@include font-size(smaller);
color: $core-grey-dark-400;

p,
.wc-block-product-description > p,
.wc-block-product-variation-data {
margin: 0.25em 0 0 0;
}
Expand Down
14 changes: 12 additions & 2 deletions assets/js/base/components/cart-checkout/product-summary/index.js
Expand Up @@ -8,19 +8,29 @@ import { getSetting } from '@woocommerce/settings';
/**
* Returns an element containing a summary of the product.
*/
const ProductSummary = ( { shortDescription = '', fullDescription = '' } ) => {
const ProductSummary = ( {
className,
shortDescription = '',
fullDescription = '',
} ) => {
const source = shortDescription ? shortDescription : fullDescription;

if ( ! source ) {
return null;
}

return (
<Summary source={ source } maxLength={ 15 } countType={ getSetting( 'wordCountType', 'words' ) } />
<Summary
className={ className }
source={ source }
maxLength={ 15 }
countType={ getSetting( 'wordCountType', 'words' ) }
/>
);
};

ProductSummary.propTypes = {
className: PropTypes.string,
shortDescription: PropTypes.string,
fullDescription: PropTypes.string,
};
Expand Down
Expand Up @@ -81,6 +81,7 @@ const Package = ( {
return (
<Panel
className="wc-block-shipping-rates-control__package"
hasBorder={ true }
initialOpen={ true }
title={ header }
>
Expand Down
Expand Up @@ -34,31 +34,8 @@
margin-bottom: 0;
}

// Resets when it's inside a panel.
.wc-block-shipping-rates-control {
.wc-block-shipping-rates-control__package.components-panel__body {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class .components-panel__body was used by the Panel component from @wordpress/components. Since we migrated to our own Panel component which has different classes, all the code below was dead code and can be safely removed.

border-bottom: none;

&,
&.is-opened {
padding-bottom: 0;
}

.wc-block-shipping-rates-control__package-items {
margin: 0;
}

.wc-block-radio-control {
width: 100%;
}

.wc-block-radio-control__option {
margin-right: 0;
max-width: none;

&:first-child {
border-top: 1px solid $core-grey-light-600;
}
}
.wc-blocks-components-panel__content {
padding-bottom: 0;
}
}
Expand Up @@ -44,6 +44,7 @@ const TotalsCouponCodeInput = ( {
return (
<Panel
className="wc-block-coupon-code"
hasBorder={ true }
initialOpen={ initialOpen }
title={
<Label
Expand Down
Expand Up @@ -15,14 +15,19 @@
flex-basis: 100%;
text-align: left;
}
}

.wc-block-radio-control__option {
&:last-child {
border-bottom: none;
}
.wc-block-radio-control__option,
.wc-block-radio-control__option-layout {
&:last-child {
border-bottom: none;
}
}

.wc-block-shipping-rates-control__no-results-notice {
margin-bottom: em($gap-small);
}

.wc-block-shipping-totals__change-address-button {
@include link-button();

Expand Down
6 changes: 5 additions & 1 deletion assets/js/base/components/panel/index.js
Expand Up @@ -15,14 +15,17 @@ const Panel = ( {
children,
className,
initialOpen = false,
hasBorder = false,
title,
titleTag: TitleTag = 'div',
} ) => {
const [ isOpen, setIsOpen ] = useState( initialOpen );

return (
<div
className={ classNames( className, 'wc-blocks-components-panel' ) }
className={ classNames( className, 'wc-blocks-components-panel', {
'has-border': hasBorder,
} ) }
>
<TitleTag>
<button
Expand Down Expand Up @@ -50,6 +53,7 @@ const Panel = ( {

Panel.propTypes = {
className: PropTypes.string,
hasBorder: PropTypes.bool,
initialOpen: PropTypes.bool,
title: PropTypes.element,
titleTag: PropTypes.string,
Expand Down
6 changes: 6 additions & 0 deletions assets/js/base/components/panel/style.scss
@@ -1,3 +1,9 @@
.wc-blocks-components-panel.has-border {
border-top: 1px solid $core-grey-light-600;
border-bottom: 1px solid $core-grey-light-600;
margin-bottom: -1px;
}

.wc-blocks-components-panel__button {
&,
&:hover,
Expand Down
7 changes: 0 additions & 7 deletions assets/js/base/components/sidebar-layout/style.scss
Expand Up @@ -17,13 +17,6 @@
width: 35%;

.wc-blocks-components-panel {
border-top: 1px solid $core-grey-light-600;
border-bottom: 1px solid $core-grey-light-600;

+ .wc-blocks-components-panel {
border-top: none;
}

> h2 {
@include font-size(large);
@include reset-box();
Expand Down
7 changes: 1 addition & 6 deletions assets/js/blocks/cart-checkout/checkout/style.scss
Expand Up @@ -13,15 +13,10 @@
}
}

.wc-block-checkout__main {
fieldset.wc-block-checkout-step:first-child {
margin-top: $gap-small;
}
}

.wc-block-checkout__sidebar {
.wc-block-product-name {
color: inherit;
padding-right: $gap-small;
flex-grow: 1;
// Required by IE11.
flex-basis: 0;
Expand Down