Skip to content

Commit

Permalink
Pass footer header styles to WooPay (#9880)
Browse files Browse the repository at this point in the history
  • Loading branch information
malithsen authored Dec 12, 2024
1 parent 02da62a commit 52dbe03
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/add-pass-footer-header-styles-to-woopay
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: add
Comment: Impovements to WooPay themeing, which is not yet released to the public.


3 changes: 3 additions & 0 deletions client/checkout/api/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ const mockAppearance = {
'.Button': {},
'.Link': {},
'.Container': {},
'.Footer': {},
'.Footer-link': {},
'.Header': {},
},
theme: 'stripe',
variables: {
Expand Down
12 changes: 12 additions & 0 deletions client/checkout/upe-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ export const appearanceSelectors = {
buttonSelectors: [ '#place_order' ],
linkSelectors: [ 'a' ],
containerSelectors: [ '.woocommerce-checkout-review-order-table' ],
headerSelectors: [ '.site-header' ],
footerSelectors: [ '.site-footer' ],
footerLink: [ '.site-footer a' ],
},

/**
Expand Down Expand Up @@ -514,6 +517,12 @@ export const getAppearance = ( elementsLocation, forWooPay = false ) => {
selectors.containerSelectors,
'.Container'
);
const headerRules = getFieldStyles( selectors.headerSelectors, '.Header' );
const footerRules = getFieldStyles( selectors.footerSelectors, '.Footer' );
const footerLinkRules = getFieldStyles(
selectors.footerLink,
'.Footer--link'
);
const globalRules = {
colorBackground: backgroundColor,
colorText: paragraphRules.color,
Expand Down Expand Up @@ -559,6 +568,9 @@ export const getAppearance = ( elementsLocation, forWooPay = false ) => {
appearance.rules = {
...appearance.rules,
'.Heading': headingRules,
'.Header': headerRules,
'.Footer': footerRules,
'.Footer-link': footerLinkRules,
'.Button': buttonRules,
'.Link': linkRules,
'.Container': containerRules,
Expand Down
23 changes: 23 additions & 0 deletions client/checkout/upe-styles/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,29 @@ describe( 'Getting styles for automated theming', () => {
'.Container': {
backgroundColor: 'rgba(0, 0, 0, 0)',
},
'.Footer': {
color: 'rgb(109, 109, 109)',
backgroundColor: 'rgba(0, 0, 0, 0)',
fontFamily:
'"Source Sans Pro", HelveticaNeue-Light, "Helvetica Neue Light"',
fontSize: '12px',
padding: '10px',
},
'.Footer-link': {
color: 'rgb(109, 109, 109)',
fontFamily:
'"Source Sans Pro", HelveticaNeue-Light, "Helvetica Neue Light"',
fontSize: '12px',
padding: '10px',
},
'.Header': {
color: 'rgb(109, 109, 109)',
backgroundColor: 'rgba(0, 0, 0, 0)',
fontFamily:
'"Source Sans Pro", HelveticaNeue-Light, "Helvetica Neue Light"',
fontSize: '12px',
padding: '10px',
},
},
labels: 'above',
} );
Expand Down
13 changes: 13 additions & 0 deletions client/checkout/upe-styles/upe-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ const upeSupportedProperties = {
...borderOutlineBackgroundProps.slice( 1 ), // Remove backgroundColor
],
'.Container': [ ...borderOutlineBackgroundProps ],
'.Header': [
...paddingColorProps,
...borderOutlineBackgroundProps,
...textFontTransitionProps,
],
'.Footer': [
...paddingColorProps,
...borderOutlineBackgroundProps,
...textFontTransitionProps,
],
};

// Restricted properties allowed to generate the automated theming of UPE.
Expand Down Expand Up @@ -113,6 +123,9 @@ export const upeRestrictedProperties = {
'.TabLabel': upeSupportedProperties[ '.TabLabel' ],
'.Block': upeSupportedProperties[ '.Block' ],
'.Container': upeSupportedProperties[ '.Container' ],
'.Header': upeSupportedProperties[ '.Header' ],
'.Footer': upeSupportedProperties[ '.Footer' ],
'.Footer--link': upeSupportedProperties[ '.Text' ],
'.Text': upeSupportedProperties[ '.Text' ],
'.Text--redirect': upeSupportedProperties[ '.Text' ],
};

0 comments on commit 52dbe03

Please sign in to comment.