Skip to content
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

Fix #997 - Truncate long email on glocal menu #1003

Merged
merged 3 commits into from
Aug 11, 2021

Conversation

codemist
Copy link
Collaborator

@codemist codemist commented Aug 9, 2021

Preview/Demo:

Screen.Recording.2021-08-09.at.11.39.13.AM.mov

@@ -20,6 +20,14 @@ glocal-menu {
right: 28px;
border-radius: 8px;
box-shadow: 0 7px 12px -3px rgba(28, 28, 29, .502);
width: auto;
max-width: $screen-sm;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set a max width of $screen-sm, which is 480px.

width: auto;
max-width: $screen-sm;

@media screen and (max-width: 520px) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic breakpoint of 520px here, which is roughly $screen-sm + some leg room to account for left/right padding.

@codemist codemist requested a review from maxxcrawford August 9, 2021 18:47
max-width: $screen-sm;

@media screen and (max-width: 520px) {
max-width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use a token here?

Comment on lines 23 to 26
width: auto;
max-width: $screen-sm;

@media screen and (max-width: 520px) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment applies for both this max-width and the max-width: 520px lines.

Could you adjust the max-width to be a calc() argument of $screen-sm minus the padding?

Then you could leave the breakpoint below at a standard, variable number.

Suggested change
width: auto;
max-width: $screen-sm;
@media screen and (max-width: 520px) {
width: auto;
max-width: calc($screen-sm - $spacing-xl);
@media screen and (max-width: $screen-sm) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to double check if calc() can accept Sass variables like that. I recall it messing up with standard CSS variables, maybe?

Copy link
Collaborator Author

@codemist codemist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -17,16 +17,16 @@ glocal-menu {
position: absolute;
visibility: hidden;
color: #000000;
right: 28px;
right: $spacing-lg;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$spacing-lg is 24px, feel that this is close enough.

border-radius: 8px;
box-shadow: 0 7px 12px -3px rgba(28, 28, 29, .502);
width: auto;
max-width: $screen-sm;
max-width: calc(#{$screen-sm} - #{$spacing-lg});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calculating a smaller width based on Protocol tokens so that the width of the component does not overflow.

left: 16px;
right: 16px;
@media screen and (max-width: $screen-sm) {
max-width: calc(#{$screen-sm} - #{$spacing-md} - #{$spacing-md});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line fine-tunes the mobile view, I switched the left/right padding to a smaller $spacing-md (16px) value and accounted for this padding in the mobile max-width. Preview: https://drive.google.com/file/d/1Q-EPRZMdOfrIFSQXbC7YKEFFy_FIS4gu/view?usp=sharing

@codemist codemist requested a review from maxxcrawford August 10, 2021 21:18
@maxxcrawford maxxcrawford merged commit 5a0f4fb into main Aug 11, 2021
@groovecoder groovecoder deleted the truncate-email-dropdown branch October 7, 2021 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants