Skip to content

Commit

Permalink
Add heading rules to appearance (#9158)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyuc authored Jul 29, 2024
1 parent 076b23e commit e993960
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/add-get-heading-color-by-selectors
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: add

Add heading rules to appearance
1 change: 1 addition & 0 deletions client/checkout/api/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const mockAppearance = {
},
'.Text': {},
'.Text--redirect': {},
'.Heading': {},
},
theme: 'stripe',
variables: {
Expand Down
7 changes: 7 additions & 0 deletions client/checkout/upe-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const appearanceSelectors = {
'form.checkout',
'body',
],
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
},
blocksCheckout: {
appendTarget: '#billing.wc-block-components-address-form',
Expand All @@ -58,6 +59,7 @@ export const appearanceSelectors = {
'.wc-block-checkout',
'body',
],
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
},
bnplProductPage: {
appendTarget: '.product .cart .quantity',
Expand All @@ -73,6 +75,7 @@ export const appearanceSelectors = {
'#main',
'body',
],
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
},
bnplClassicCart: {
appendTarget: '.cart .quantity',
Expand All @@ -88,6 +91,7 @@ export const appearanceSelectors = {
'#main',
'body',
],
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
},
bnplCartBlock: {
appendTarget: '.wc-block-cart .wc-block-components-quantity-selector',
Expand All @@ -107,6 +111,7 @@ export const appearanceSelectors = {
'.wp-block-woocommerce-cart',
'body',
],
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
},

/**
Expand Down Expand Up @@ -436,6 +441,7 @@ export const getAppearance = ( elementsLocation ) => {
};

const backgroundColor = getBackgroundColor( selectors.backgroundSelectors );
const headingRules = getFieldStyles( selectors.headingSelectors, '.Label' );
const blockRules = getFieldStyles(
selectors.upeThemeLabelSelector,
'.Block',
Expand Down Expand Up @@ -464,6 +470,7 @@ export const getAppearance = ( elementsLocation ) => {
'.TabIcon--selected': selectedTabIconRules,
'.Text': labelRules,
'.Text--redirect': labelRules,
'.Heading': headingRules,
},
};
// Remove hidden fields from DOM.
Expand Down
7 changes: 7 additions & 0 deletions client/checkout/upe-styles/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ describe( 'Getting styles for automated theming', () => {
padding: '10px',
backgroundColor: '#ffffff',
},
'.Heading': {
color: 'rgb(109, 109, 109)',
fontFamily:
'"Source Sans Pro", HelveticaNeue-Light, "Helvetica Neue Light"',
fontSize: '12px',
padding: '10px',
},
},
} );
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ describe( 'WoopayExpressCheckoutButton', () => {
},
'.Text': {},
'.Text--redirect': {},
'.Heading': {},
},
theme: 'stripe',
variables: {
Expand Down

0 comments on commit e993960

Please sign in to comment.