-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve BNPL PMME and icon placement in shortcode checkout #9993
Open
gpressutto5
wants to merge
7
commits into
develop
Choose a base branch
from
improve-pmme-placement-shortcode
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+109
−36
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
18ce08a
WIP Improve BNPL PMME and icon placement in shortcode checkout
gpressutto5 2d3abdb
Improve BNPL PMME and icon placement in shortcode checkout
gpressutto5 7f44766
Fix js
gpressutto5 76db323
Merge branch 'develop' into improve-pmme-placement-shortcode
gpressutto5 3b1238c
Merge branch 'develop' into improve-pmme-placement-shortcode
gpressutto5 26c55cf
Fixed style for Twenty Twenty Three theme
gpressutto5 4bf0445
Merge branch 'develop' into improve-pmme-placement-shortcode
frosso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: update | ||
|
||
Improve BNPL PMME and icon placement in shortcode checkout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
position: relative; | ||
} | ||
|
||
// Stripe Link button styles. | ||
.wcpay-checkout-email-field button.wcpay-stripelink-modal-trigger { | ||
display: none; | ||
position: absolute; | ||
|
@@ -30,66 +31,108 @@ | |
border: none; | ||
} | ||
|
||
// Logo styles. | ||
#payment .payment_methods { | ||
li[class*='payment_method_woocommerce_payments'] label img { | ||
float: right; | ||
border: 0; | ||
padding: 0; | ||
height: 24px !important; | ||
max-height: 24px !important; | ||
li[class*='payment_method_woocommerce_payments'] label { | ||
display: inline; | ||
img { | ||
float: right; | ||
border: 0; | ||
padding: 0; | ||
height: 24px !important; | ||
max-height: 24px !important; | ||
} | ||
} | ||
} | ||
|
||
li.wc_payment_method:has( .input-radio:not( :checked ) | ||
+ label | ||
.stripe-pmme-container ) { | ||
// Payment methods with PMME styles. | ||
li.wc_payment_method:has( label .stripe-pmme-container ) { | ||
display: grid; | ||
grid-template-columns: min-content 1fr; | ||
grid-template-rows: auto auto; | ||
grid-template-columns: max-content 1fr; | ||
grid-template-areas: 'li-input li-label'; // List Item grid. | ||
align-items: baseline; | ||
|
||
.input-radio { | ||
grid-row: 1; | ||
grid-column: 1; | ||
grid-area: li-input; | ||
} | ||
|
||
label { | ||
grid-column: 2; | ||
grid-row: 1; | ||
} | ||
> label { | ||
grid-area: li-label; | ||
|
||
img { | ||
grid-row: 1 / span 2; | ||
align-self: center; | ||
} | ||
display: grid !important; | ||
grid-template-columns: max-content 1fr; | ||
grid-template-areas: 'label-spacer label-inner'; // Label grid. | ||
|
||
.stripe-pmme-container { | ||
width: 100%; | ||
grid-column: 1; | ||
grid-row-start: 2; | ||
pointer-events: none; | ||
} | ||
> span.spacer { | ||
grid-area: label-spacer; | ||
} | ||
|
||
> .woopayments-inner-label { | ||
grid-area: label-inner; | ||
display: grid; | ||
grid-template-columns: 1fr max-content; | ||
grid-template-areas: | ||
'inner-text inner-logo' | ||
'inner-pmme inner-logo'; // Inner label grid. | ||
align-items: center; | ||
|
||
> img { | ||
grid-area: inner-logo; | ||
justify-self: right; | ||
} | ||
|
||
.payment_box { | ||
flex: 0 0 100%; | ||
grid-row: 2; | ||
grid-column: 1 / span 2; | ||
> .stripe-pmme-container { | ||
width: 100%; | ||
grid-area: inner-pmme; | ||
pointer-events: none; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Hide the PMMe container when the payment method is checked. | ||
li.wc_payment_method:has( .input-radio:checked | ||
+ label | ||
.stripe-pmme-container ) { | ||
display: block; | ||
|
||
.input-radio:checked { | ||
+ label { | ||
.stripe-pmme-container { | ||
display: none; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Pseudo-element radio button compatibility. | ||
// Unfortunately, there is no direct way to detect the existence of pseudo-elements like ::before using CSS selectors, | ||
// so we use the theme class to add the necessary styles. | ||
.theme-storefront, | ||
.theme-twentytwentythree { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
#payment { | ||
.payment_methods { | ||
> li.wc_payment_method { | ||
// Storefront does not render the input radio button. | ||
grid-template-areas: 'li-label'; // List Item grid for Storefront. | ||
grid-template-columns: 1fr; | ||
|
||
> input + label { | ||
// Storefront uses a label::before for the radio button so we need to adjust the grid. | ||
grid-template-areas: 'label-before label-spacer label-inner'; // Label grid for Storefront. | ||
grid-template-columns: max-content max-content 1fr; | ||
} | ||
|
||
> input + label { | ||
&::before { | ||
grid-area: label-before; | ||
} | ||
} | ||
} | ||
|
||
img { | ||
grid-column: 2; | ||
// This makes sure labels that don't have the pmme container are displayed correctly. | ||
li[class*='payment_method_woocommerce_payments'] { | ||
> input + label { | ||
display: block; | ||
} | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful for our future selves to add a comment here to indicate that the spacer has been added because WC Core adds the
, and the spacer is useful to ensure all labels are vertically aligned properly