-
Notifications
You must be signed in to change notification settings - Fork 293
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
Update "improve your measurement" section mobile design to match Figma #9832
Update "improve your measurement" section mobile design to match Figma #9832
Conversation
@media (min-width: $bp-tablet) { | ||
margin-left: 42px; // margin-left = 32px switch width + 10px margin-left of label. | ||
} | ||
margin: 6px 0 0 42px; // margin-left = 32px switch width + 10px margin-left of label. |
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.
Can we use calc
to do this instead of hard coding with a comment?
Build files for 06417ac have been deleted. |
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.
Thanks @benbowler, please see my comment about the use of calc()
in this context.
@media (min-width: $bp-tablet) { | ||
margin-left: 42px; // margin-left = 32px switch width + 10px margin-left of label. | ||
} | ||
margin: 6px 0 0 calc(32px + 10px); |
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'm not sure if this is what @aaemnnosttv had in mind with his suggestion - using calc()
to add two unnamed values isn't really an improvement on what we had before, it's less readable and introduces an unnecessary calc()
to add two static values.
Unfortunately as things stand I don't see that we can use calc()
to reference the values of the relevant element dimension/properties. We could do something like this to derive the value:
diff --git a/assets/sass/components/settings/_googlesitekit-settings-group.scss b/assets/sass/components/settings/_googlesitekit-settings-group.scss
index c1625f2fb2..1eade3778c 100644
--- a/assets/sass/components/settings/_googlesitekit-settings-group.scss
+++ b/assets/sass/components/settings/_googlesitekit-settings-group.scss
@@ -55,7 +55,7 @@
color: $c-surfaces-on-surface-variant;
flex-basis: 100%;
font-size: $fs-label-sm;
- margin: 6px 0 0 calc(32px + 10px);
+ margin: 6px 0 0 $mdc-switch-track-width + $mdc-switch-label-margin-left;
}
.googlesitekit-analytics-enable-enhanced-measurement--loading {
diff --git a/assets/sass/config/_variables.scss b/assets/sass/config/_variables.scss
index e341c8792c..ef560d2231 100644
--- a/assets/sass/config/_variables.scss
+++ b/assets/sass/config/_variables.scss
@@ -308,6 +308,8 @@ $mdc-text-field-error: $c-utility-error;
$mdc-text-field-placeholder-ink-color: $c-interactive-on-disable-container;
$mdc-text-field-label: $c-interactive-on-disable-container;
+$mdc-switch-label-margin-left: 10px;
+
// Custom max width for settings notice content
$max-width-settings-notice-content: 1098px;
diff --git a/assets/sass/vendor/_mdc-switch.scss b/assets/sass/vendor/_mdc-switch.scss
index 0e0b0d0a7e..53b4a86ed7 100644
--- a/assets/sass/vendor/_mdc-switch.scss
+++ b/assets/sass/vendor/_mdc-switch.scss
@@ -40,7 +40,7 @@
font-size: $fs-body-md;
letter-spacing: $ls-s;
line-height: $lh-body-md;
- margin-left: 10px;
+ margin-left: $mdc-switch-label-margin-left;
}
.mdc-switch__track {
$mdc-switch-track-width
comes from the vendor's mixin and is defined here: https://github.com/material-components/material-components-web/blob/3a1767ea4da308dbee272763a377deff39cf0471/packages/mdc-switch/_variables.scss#L25
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.
Thanks @techanvil, I couldn't find those variables initially.
Size Change: +128 B (+0.01%) Total Size: 1.97 MB
ℹ️ View Unchanged
|
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.
Thanks @benbowler, LGTM!
Summary
Addresses issue:
Relevant technical choices
@benbowler updated 9 December 2024, reviewing and fixing tests and VRTs.
PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist