-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Checkout: Adjust label style to accommodate more cards #94693
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~90 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~74 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
I may be doing something wrong, but when I try to test with a smaller viewport in the Chrome Inspector tools, I don't get the logos on a second line. I still see them pushed to the side. This is happening with both active and inactive payment methods. I am using the |
text-align: right; | ||
flex-wrap: wrap; | ||
gap: 5px; | ||
text-align: end; |
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.
This should resolve the PayPal logo issue. Changed to a more responsive value to handle RTL better.
} | ||
svg { | ||
&.credit-card__logo svg { | ||
display: inline-block; |
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.
More specific to avoid shrinking non-card logos (like PayPal)
&.has-background { |
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.
Not really needed if we set a default size for the card logos and apply some flex gap.
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
@@ -126,7 +129,7 @@ const Label = styled.label< LabelProps & React.LabelHTMLAttributes< HTMLLabelEle | |||
content: ''; | |||
border: 1px solid ${ ( props ) => props.theme.colors.borderColor }; | |||
border-radius: 100%; | |||
top: 28px; | |||
top: 40%; |
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.
These radios dots are rather difficult to work with since they are absolutely positioned before and after the label. It might be worth rebuilding this component in the future so we can properly align the radio > label > and logos with flex or grid.
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.
Works as described at all the widths and scenarios I tested. One thing that occurs to me is that we could hide the credit card logos at small widths like we do with all the other logos. But this works and looks good so I have no complaints.
@sirbrillig Made a slight change to incorporate this:
Essentially, hide the logos when inactive (with less space to use) and then show when we click on the add method option. This only applies below 400px wide. Everything else works as before. |
I haven't tested that change but the code looks fine and it sounds good. |
The labels in Checkout were breaking out of their bounding box on small mobile viewports (< 375px), this PR adjusts how we handle the credit card logos across viewport sizes and tries to gracefully wrap them at different device sizes.
A side benefit to this is that the changes also extend to the 'Add a payment method' and 'Change payment method' forms in the Purchases section.
Proposed Changes
Left to Right
Viewport 1024px - Inactive payment method
Not very different at this viewport
View port 425px - Inactive payment method
Small changes at this size, the logos begin to wrap now. The benefit becomes more obvious at certain sizes like 375px wide where the logos drop onto their own line.
Viewport 320px - Inactive payment method
Most visible at this size, fixes a bug where label items would overflow their bounding box by dropping cards to next line.
Viewport 1024px - Active payment method
Not much change here other than standardizing the sizes of the svg logos for better alignment
Viewport 320px - Active payment method
Logos will stack at this viewport size
Testing Instructions