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

Update "improve your measurement" section mobile design to match Figma #9832

Merged
merged 5 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,32 @@ export default function ConversionTrackingToggle( { children, loading } ) {
return (
<div>
<LoadingWrapper loading={ loading } width="180px" height="21.3px">
<Switch
label={ __(
'Enhanced conversion tracking',
'google-site-kit'
) }
checked={ isConversionTrackingEnabled }
disabled={ isSaving || loading }
onClick={ () => {
// If Conversion Tracking is currently enabled, show a confirmation
// dialog warning users about the impact of disabling it.
if ( isConversionTrackingEnabled ) {
trackEvent( `${ viewContext }`, 'ect_disable' );
<div className="googlesitekit-module-settings-group__switch">
<Switch
label={ __(
'Enhanced conversion tracking',
'google-site-kit'
) }
checked={ isConversionTrackingEnabled }
disabled={ isSaving || loading }
onClick={ () => {
// If Conversion Tracking is currently enabled, show a confirmation
// dialog warning users about the impact of disabling it.
if ( isConversionTrackingEnabled ) {
trackEvent( `${ viewContext }`, 'ect_disable' );

setShowConfirmDialog( true );
} else {
trackEvent( `${ viewContext }`, 'ect_enable' );
setShowConfirmDialog( true );
} else {
trackEvent( `${ viewContext }`, 'ect_enable' );

// Conversion Tracking is not currently enabled, so this toggle
// enables it.
setConversionTrackingEnabled( true );
}
} }
hideLabel={ false }
/>
// Conversion Tracking is not currently enabled, so this toggle
// enables it.
setConversionTrackingEnabled( true );
}
} }
hideLabel={ false }
/>
</div>
</LoadingWrapper>
{ !! saveError && <ErrorText message={ saveError.message } /> }
<LoadingWrapper
Expand Down
18 changes: 10 additions & 8 deletions assets/js/components/first-party-mode/FirstPartyModeToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useMount } from 'react-use';
/**
* WordPress dependencies
*/
import { Fragment, useCallback } from '@wordpress/element';
import { useCallback } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
Expand Down Expand Up @@ -74,7 +74,7 @@ export default function FirstPartyModeToggle( { className } ) {
/>
) }
{ ! isLoading && (
<Fragment>
<div className="googlesitekit-module-settings-group__switch">
<Switch
label={ __( 'First-party mode', 'google-site-kit' ) }
checked={
Expand All @@ -85,12 +85,14 @@ export default function FirstPartyModeToggle( { className } ) {
onClick={ handleClick }
hideLabel={ false }
/>
<Badge
className="googlesitekit-badge--beta"
hasLeftSpacing
label={ __( 'Beta', 'google-site-kit' ) }
/>
</Fragment>
<div className="googlesitekit-first-party-mode-toggle__switch-badge">
<Badge
className="googlesitekit-badge--beta"
hasLeftSpacing
label={ __( 'Beta', 'google-site-kit' ) }
/>
</div>
</div>
) }
<p className="googlesitekit-module-settings-group__helper-text">
{ __(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,51 @@ exports[`FirstPartyModeToggle should render in default state 1`] = `
class="googlesitekit-first-party-mode-toggle"
>
<div
aria-checked="false"
class="mdc-switch"
role="switch"
tabindex="0"
class="googlesitekit-module-settings-group__switch"
>
<div
class="mdc-switch__track"
aria-checked="false"
class="mdc-switch"
role="switch"
tabindex="0"
>

<div
class="mdc-switch__track"
>

</div>
<div
class="mdc-switch__thumb-underlay"
>
<div
class="mdc-switch__thumb"
>
<input
class="mdc-switch__native-control"
id="googlesitekit-switch-4"
readonly=""
role="switch"
type="checkbox"
/>
</div>
</div>
</div>
<label
class=""
for="googlesitekit-switch-4"
>
First-party mode
</label>
<div
class="mdc-switch__thumb-underlay"
class="googlesitekit-first-party-mode-toggle__switch-badge"
>
<div
class="mdc-switch__thumb"
<span
class="googlesitekit-badge googlesitekit-badge--beta googlesitekit-badge--has-left-spacing"
>
<input
class="mdc-switch__native-control"
id="googlesitekit-switch-4"
readonly=""
role="switch"
type="checkbox"
/>
</div>
Beta
</span>
</div>
</div>
<label
class=""
for="googlesitekit-switch-4"
>
First-party mode
</label>
<span
class="googlesitekit-badge googlesitekit-badge--beta googlesitekit-badge--has-left-spacing"
>
Beta
</span>
<p
class="googlesitekit-module-settings-group__helper-text"
>
Expand All @@ -58,44 +66,52 @@ exports[`FirstPartyModeToggle should render in disabled state if server requirem
class="googlesitekit-first-party-mode-toggle"
>
<div
aria-checked="false"
class="mdc-switch mdc-switch--disabled"
role="switch"
tabindex="0"
class="googlesitekit-module-settings-group__switch"
>
<div
class="mdc-switch__track"
aria-checked="false"
class="mdc-switch mdc-switch--disabled"
role="switch"
tabindex="0"
>

<div
class="mdc-switch__track"
>

</div>
<div
class="mdc-switch__thumb-underlay"
>
<div
class="mdc-switch__thumb"
>
<input
class="mdc-switch__native-control"
disabled=""
id="googlesitekit-switch-6"
readonly=""
role="switch"
type="checkbox"
/>
</div>
</div>
</div>
<label
class=""
for="googlesitekit-switch-6"
>
First-party mode
</label>
<div
class="mdc-switch__thumb-underlay"
class="googlesitekit-first-party-mode-toggle__switch-badge"
>
<div
class="mdc-switch__thumb"
<span
class="googlesitekit-badge googlesitekit-badge--beta googlesitekit-badge--has-left-spacing"
>
<input
class="mdc-switch__native-control"
disabled=""
id="googlesitekit-switch-6"
readonly=""
role="switch"
type="checkbox"
/>
</div>
Beta
</span>
</div>
</div>
<label
class=""
for="googlesitekit-switch-6"
>
First-party mode
</label>
<span
class="googlesitekit-badge googlesitekit-badge--beta googlesitekit-badge--has-left-spacing"
>
Beta
</span>
<p
class="googlesitekit-module-settings-group__helper-text"
>
Expand Down
25 changes: 19 additions & 6 deletions assets/sass/components/settings/_googlesitekit-settings-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
display: flex;
flex-direction: column;
gap: 20px;
padding: $grid-gap-desktop;
padding: $grid-gap-desktop $grid-gap-phone;

@media (min-width: $bp-tablet) {
padding: $grid-gap-desktop;
}

h4 {
font-family: $f-primary;
Expand All @@ -34,15 +38,24 @@
margin: 0;
}

.googlesitekit-module-settings-group__switch {
display: flex;

.mdc-switch {
top: 3px;
}
}

.googlesitekit-first-party-mode-toggle__switch-badge {
position: relative;
top: -2px;
}

.googlesitekit-module-settings-group__helper-text {
color: $c-surfaces-on-surface-variant;
flex-basis: 100%;
font-size: $fs-label-sm;
margin: 6px 0 0;

@media (min-width: $bp-tablet) {
margin-left: 42px; // margin-left = 32px switch width + 10px margin-left of label.
}
margin: 6px 0 0 $mdc-switch-track-width + $mdc-switch-label-margin-left;
}

.googlesitekit-analytics-enable-enhanced-measurement--loading {
Expand Down
1 change: 1 addition & 0 deletions assets/sass/config/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ $mdc-typography-styles-subtitle1: (
$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;
Expand Down
2 changes: 1 addition & 1 deletion assets/sass/vendor/_mdc-switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading