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

enhance(language-menu): explain "Remember language" + link announcement #11865

Merged
merged 9 commits into from
Sep 25, 2024
10 changes: 5 additions & 5 deletions client/src/ui/atoms/icon/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ $icons: "add-filled", "add", "altname", "bell", "bell-filled", "bell-ring",
"mastodon", "menu-filled", "menu", "mobile", "more", "theme-dark", "new-topic",
"next", "no", "nodejs", "nonstandard", "note-info", "note-warning",
"note-deprecated", "opera", "padlock", "partial", "play", "prefix", "preview",
"previous", "queue", "queued", "quote", "return", "safari", "samsunginternet",
"search", "send", "server", "sidebar", "simple-firefox", "small-arrow",
"theme-light", "star-filled", "star", "theme-os-default", "thumbs-down",
"thumbs-up", "trash", "trash-filled", "twitter-x", "unknown", "warning",
"webview", "yes", "yes-circle";
"previous", "question-mark", "queue", "queued", "quote", "return", "safari",
"samsunginternet", "search", "send", "server", "sidebar", "simple-firefox",
"small-arrow", "theme-light", "star-filled", "star", "theme-os-default",
"thumbs-down", "thumbs-up", "trash", "trash-filled", "twitter-x", "unknown",
"warning", "webview", "yes", "yes-circle";

.icon {
--size: var(--icon-size, 1rem);
Expand Down
2 changes: 1 addition & 1 deletion client/src/ui/molecules/submenu/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
width: 100%;
}

a,
li > a,
.submenu-item {
align-items: center;
border: 1px solid transparent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
background-color: unset;
}

.group {
align-items: center;
display: flex;
gap: 0.5em;
}

.switch {
display: flex;
}
Expand All @@ -39,9 +45,17 @@
font-style: italic;
font-variation-settings: "slnt" -10;
margin-top: 0.5em;
}

.icon {
margin-right: unset;
}

a[href] .icon-question-mark {
background-color: var(--icon-secondary);

.icon {
margin-right: unset;
&:hover {
background-color: var(--text-link);
}
}
}
Expand Down
27 changes: 19 additions & 8 deletions client/src/ui/organisms/article-actions/language-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from "../../../../utils";
import { GleanThumbs } from "../../../atoms/thumbs";
import { Switch } from "../../../atoms/switch";
import { Icon } from "../../../atoms/icon";

// This needs to match what's set in 'libs/constants.js' on the server/builder!
const PREFERRED_LOCALE_COOKIE_NAME = "preferredlocale";
Expand Down Expand Up @@ -146,7 +147,7 @@ function LocaleRedirectSetting() {
maxAge: 60 * 60 * 24 * 365 * 3,
});
setPreferredLocale(locale);
gleanClick(`${LANGUAGE_REMEMBER}: ${oldValue} -> ${locale}`);
gleanClick(`${LANGUAGE_REMEMBER}: ${oldValue ?? 0} -> ${locale}`);
} else {
deleteCookie(PREFERRED_LOCALE_COOKIE_NAME);
setPreferredLocale(undefined);
Expand All @@ -156,13 +157,23 @@ function LocaleRedirectSetting() {

return (
<form className="submenu-item locale-redirect-setting">
<Switch
name="locale-redirect"
checked={locale === preferredLocale}
toggle={toggle}
>
Remember language
</Switch>
<div className="group">
<Switch
name="locale-redirect"
checked={locale === preferredLocale}
toggle={toggle}
>
Remember language
</Switch>
<a
href="https://github.com/orgs/mdn/discussions/739"
rel="external noopener noreferrer"
target="_blank"
title="Enable this setting to automatically switch to this language when it's available. (Click to learn more.)"
>
<Icon name="question-mark" />
</a>
</div>
<GleanThumbs feature="locale-redirect" question="Is this useful?" />
</form>
);
Expand Down
Loading