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

Add theme-level global styles to Cart and Checkout block #8809

Merged
merged 35 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ce4a516
Dummy commit to open a PR
Mar 21, 2023
43bf109
Revert the last change
Mar 21, 2023
3e70b42
Merge branch 'trunk' into add/global-style-for-cart-checkout
Mar 22, 2023
24cf4a2
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Mar 23, 2023
ec957c4
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Mar 25, 2023
26ef611
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Mar 29, 2023
59fe578
Ensure Checkout block supports the theme-level global styles for `Col…
nielslange Mar 29, 2023
788f234
Fix link margin/padding (#8908)
mikejolley Mar 30, 2023
d9c57a6
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Mar 31, 2023
a40239b
Merge branch 'trunk' into add/global-style-for-cart-checkout
Apr 3, 2023
fe2a744
Replace <AddToCartButton /> with <ProductButton /> (#8914)
nielslange Apr 4, 2023
df7db1d
Add GS support for button typography in Checkout block (#8918)
nielslange Apr 4, 2023
37dc54e
Ensure Checkout block supports the theme-level global styles for Typo…
nielslange Apr 4, 2023
a023c02
Remove classname from cart image to avoid conflicts (#8898)
mikejolley Apr 5, 2023
8f12c40
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 6, 2023
c9815f2
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 6, 2023
55f40c6
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 11, 2023
6745438
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 17, 2023
a836efd
Merge branch 'trunk' into add/global-style-for-cart-checkout
Apr 17, 2023
14b8cad
Use consistent and semantically correct HTML elements in the Cart and…
nielslange Apr 18, 2023
6d11058
Merge branch 'trunk' into add/global-style-for-cart-checkout
Apr 18, 2023
0acf85d
Merge branch 'trunk' into add/global-style-for-cart-checkout
Apr 19, 2023
d0c3ceb
Merge branch 'trunk' into add/global-style-for-cart-checkout
Apr 19, 2023
ea2d0a8
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 19, 2023
2cbd5de
Merge branch 'trunk' into add/global-style-for-cart-checkout
Apr 20, 2023
b199d69
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 21, 2023
08df53a
Allow button height to adjust
nielslange Apr 21, 2023
aed60f1
Ensure to display full width heading background
nielslange Apr 21, 2023
21f7cf3
Inherit font style and font weight for headings
nielslange Apr 21, 2023
268d469
Inherit font style and font weight for textarea
nielslange Apr 21, 2023
9ab0127
Inherit font family and font weight for buttons
nielslange Apr 21, 2023
fa915ee
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 21, 2023
d135f8c
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 21, 2023
15ed70c
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 21, 2023
c9732a8
Merge branch 'trunk' into add/global-style-for-cart-checkout
nielslange Apr 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion assets/css/abstracts/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ $fontSizes: (
vertical-align: baseline;
}

@mixin reset-typography() {
@mixin reset-color() {
color: inherit;
}

@mixin reset-typography() {
font-family: inherit;
font-size: inherit;
font-style: inherit;
Expand All @@ -138,6 +141,7 @@ $fontSizes: (
// Reset <h1>, <h2>, etc. styles as if they were text. Useful for elements that must be headings for a11y but don't need those styles.
@mixin text-heading() {
@include reset-box();
@include reset-color();
@include reset-typography();
box-shadow: none;
display: inline;
Expand All @@ -148,6 +152,7 @@ $fontSizes: (
// Reset <button> style as if it was text. Useful for elements that must be `<button>` for a11y but don't need those styles.
@mixin text-button() {
@include reset-box();
@include reset-color();
@include reset-typography();
background: transparent;
box-shadow: none;
Expand Down
22 changes: 0 additions & 22 deletions assets/js/base/components/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@
}

body:not(.woocommerce-block-theme-has-button-styles) .wc-block-components-button:not(.is-link) {
@include reset-typography();
font-weight: bold;
line-height: 1;
padding: 0 em($gap);
text-decoration: none;
text-transform: none;

&:focus {
box-shadow: 0 0 0 2px $studio-blue;
Expand All @@ -77,21 +72,4 @@ body:not(.woocommerce-block-theme-has-button-styles) .wc-block-components-button
opacity: 0.9;
}
}

&.contained {
background-color: $gray-900;
color: $white;

&:disabled,
&:hover,
&:focus,
&:active {
background-color: $gray-900;
color: $white;
}

&:hover {
opacity: 0.9;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const OrderSummary = ( {
{ __( 'Order summary', 'woo-gutenberg-products-block' ) }
</span>
}
titleTag="h2"
>
<div className="wc-block-components-order-summary__content">
{ cartItems.map( ( cartItem ) => {
Expand Down
146 changes: 73 additions & 73 deletions assets/js/base/components/cart-checkout/order-summary/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,97 +8,97 @@
.wc-block-components-panel__content {
margin-bottom: 0;
}
}

.wc-block-components-order-summary__content {
display: table;
width: 100%;
}
.wc-block-components-order-summary__content {
display: table;
width: 100%;
}

.wc-block-components-order-summary-item {
@include with-translucent-border(0 0 1px);
@include font-size(small);
display: flex;
padding-bottom: 1px;
padding-top: $gap;
width: 100%;
.wc-block-components-order-summary-item {
@include with-translucent-border(0 0 1px);
@include font-size(small);
display: flex;
padding-bottom: 1px;
padding-top: $gap;
width: 100%;

&:first-child {
padding-top: 0;
}
&:first-child {
padding-top: 0;
}

&:last-child {
> div {
padding-bottom: 0;
&:last-child {
> div {
padding-bottom: 0;
}

&::after {
display: none;
}
}

&::after {
display: none;
.wc-block-components-product-metadata {
@include font-size(regular);
}
}

.wc-block-components-product-metadata {
@include font-size(regular);
.wc-block-components-order-summary-item__image,
.wc-block-components-order-summary-item__description {
display: table-cell;
vertical-align: top;
}
}

.wc-block-components-order-summary-item__image,
.wc-block-components-order-summary-item__description {
display: table-cell;
vertical-align: top;
}

.wc-block-components-order-summary-item__image {
width: #{$gap-large * 2};
padding-bottom: $gap;
position: relative;

> img {
.wc-block-components-order-summary-item__image {
width: #{$gap-large * 2};
max-width: #{$gap-large * 2};
padding-bottom: $gap;
position: relative;

> img {
width: #{$gap-large * 2};
max-width: #{$gap-large * 2};
}
}
}

.wc-block-components-order-summary-item__quantity {
align-items: center;
background: #fff;
border: 2px solid;
border-radius: 1em;
box-shadow: 0 0 0 2px #fff;
color: #000;
display: flex;
line-height: 1;
min-height: 20px;
padding: 0 0.4em;
position: absolute;
justify-content: center;
min-width: 20px;
right: 0;
top: 0;
transform: translate(50%, -50%);
white-space: nowrap;
z-index: 1;
}
.wc-block-components-order-summary-item__quantity {
align-items: center;
background: #fff;
border: 2px solid;
border-radius: 1em;
box-shadow: 0 0 0 2px #fff;
color: #000;
display: flex;
line-height: 1;
min-height: 20px;
padding: 0 0.4em;
position: absolute;
justify-content: center;
min-width: 20px;
right: 0;
top: 0;
transform: translate(50%, -50%);
white-space: nowrap;
z-index: 1;
}

.wc-block-components-order-summary-item__description {
padding-left: $gap-large;
padding-right: $gap-small;
padding-bottom: $gap;
.wc-block-components-order-summary-item__description {
padding-left: $gap-large;
padding-right: $gap-small;
padding-bottom: $gap;

p,
.wc-block-components-product-metadata {
line-height: 1.375;
margin-top: #{ ($gap-large - $gap) * 0.5 };
p,
.wc-block-components-product-metadata {
line-height: 1.375;
margin-top: #{ ($gap-large - $gap) * 0.5 };
}
}
}

.wc-block-components-order-summary-item__total-price {
font-weight: bold;
margin-left: auto;
text-align: right;
}
.wc-block-components-order-summary-item__total-price {
font-weight: bold;
margin-left: auto;
text-align: right;
}


.wc-block-components-order-summary-item__individual-prices {
display: block;
.wc-block-components-order-summary-item__individual-prices {
display: block;
}
}
13 changes: 1 addition & 12 deletions assets/js/base/components/cart-checkout/product-image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
import { decodeEntities } from '@wordpress/html-entities';
import { PLACEHOLDER_IMG_SRC } from '@woocommerce/settings';

/**
* Internal dependencies
*/
import './style.scss';

interface ProductImageProps {
image: { alt?: string; thumbnail?: string };
fallbackAlt: string;
Expand Down Expand Up @@ -37,13 +32,7 @@ const ProductImage = ( {
alt: '',
};

return (
<img
className="wc-block-components-product-image"
{ ...imageProps }
alt={ imageProps.alt }
/>
);
return <img { ...imageProps } alt={ imageProps.alt } />;
};

export default ProductImage;

This file was deleted.

1 change: 1 addition & 0 deletions assets/js/base/components/radio-control/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.wc-block-components-radio-control__option {
@include reset-color();
@include reset-typography();
display: block;
margin: em($gap) 0;
Expand Down
5 changes: 4 additions & 1 deletion assets/js/base/components/sidebar-layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@
.is-large {
.wc-block-components-sidebar {
.wc-block-components-totals-item,
.wc-block-components-totals-coupon-link,
.wc-block-components-panel {
padding-left: $gap;
padding-right: $gap;
}
.wc-block-components-totals-coupon-link {
margin-left: $gap;
margin-right: $gap;
}

.wc-block-components-panel {
.wc-block-components-totals-item {
Expand Down
5 changes: 5 additions & 0 deletions assets/js/base/components/title/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
@include reset-box();
@include font-size(large);
word-break: break-word;

textarea {
letter-spacing: inherit;
text-transform: inherit;
}
}

// For Twenty Twenty we need to increase specificity a bit more.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
}

label {
@include reset-color();
@include reset-typography();
@include font-size(regular);
line-height: 1.375; // =22px when font-size is 16px.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { Block as ProductRating } from '../../../atomic/blocks/product-elements/
import { Block as ProductSaleBadge } from '../../../atomic/blocks/product-elements/sale-badge/block';
import { Block as ProductPrice } from '../../../atomic/blocks/product-elements/price/block';
import { Block as ProductButton } from '../../../atomic/blocks/product-elements/button/block';
import AddToCartButton from '../../../atomic/blocks/product-elements/add-to-cart/block';
import { ImageSizing } from '../../../atomic/blocks/product-elements/image/types';

interface CrossSellsProductProps {
Expand Down Expand Up @@ -60,11 +59,7 @@ const CartCrossSellsProduct = ( {
/>
<ProductPrice />
</div>
{ product.is_in_stock ? (
<AddToCartButton />
) : (
<ProductButton />
) }
<ProductButton />
</ProductDataContextProvider>
</InnerBlockLayoutContextProvider>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
import Title from '@woocommerce/base-components/title';
import classnames from 'classnames';

const Block = ( {
Expand All @@ -12,12 +11,11 @@ const Block = ( {
content: string;
} ): JSX.Element => {
return (
<Title
headingLevel="2"
<span
className={ classnames( className, 'wc-block-cart__totals-title' ) }
>
{ content }
</Title>
</span>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import { PlainText, useBlockProps } from '@wordpress/block-editor';
import Title from '@woocommerce/base-components/title';
import classnames from 'classnames';

/**
Expand All @@ -24,8 +23,7 @@ export const Edit = ( {
const blockProps = useBlockProps();
return (
<div { ...blockProps }>
<Title
headingLevel="2"
<span
className={ classnames(
className,
'wc-block-cart__totals-title'
Expand All @@ -39,7 +37,7 @@ export const Edit = ( {
}
style={ { backgroundColor: 'transparent' } }
/>
</Title>
</span>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
height: auto;

.wc-block-components-button__text {
line-height: 24px;

> svg {
fill: $white;
vertical-align: top;
Expand Down
Loading