-
Notifications
You must be signed in to change notification settings - Fork 36
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
DOP-4715: Upgrade consistent nav to "v2.1.0" #1108
Conversation
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.
LGTM with one non-blocking nit!
Might need to update tests? Not so sure, would love input on that
I think we can create a test for onSelectLocale
if we want to be safe, but I also think behavior is straightforward enough. localizePath
does most of the heavy lifting and it's already tested
src/utils/locale.js
Outdated
const location = window.location; | ||
if (isBrowser) { |
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.
(Nit) window
is a browser API and thinking about it now, I think this function would only be called on a browser, so I'm actually wondering if we need this check for isBrowser
? I think it would make sense to either remove the unnecessary condition, or move const location = window.location
to be within the condition if we're sure we need the isBrowser
check for consistency
Stories/Links:
DOP-4715
Current Behavior:
Cloud docs landing page
Staging Links:
English cloud-docs landing page (has Japanese language available in dropdown)
"Japanese" cloud-docs landing page (only navigable from English page)
"Portuguese" cloud-docs landing page
"Korean" cloud-docs landing page
"Simplified Chinese" cloud-docs landing page
You can switch between these pages using the header or footer (will need to append
index.html
after the switch). The footer/header should match and correspond to the current link.Notes:
The original request of this ticket was to upgrade the @mdb/consistent-nav package to v2.1.0 so the Language Selector would be available in the header. However, it was quite difficult to get the selector to only display the four languages supported by docs (English, Portuguese, Korean, Simplified Chinese)—fortunately, the web team is including a feature to enable that in v2.1.1-rc.1 (see ticket comment).
Therefore, this PR is updating the consistent nav to v2.1.1-rc.1 to make use of the aforementioned feature, as well as adds support for locale changes to the header. The
onSelectLocale
function was also moved to thelocale.js
file to reduce duplication.You can test locally by setting
COMMIT_HASH
as one of theenabledLocales
(en-us
,pt-br
,ko-kr
,zh-cn
) in your.env.*
files.Might need to update tests? Not so sure, would love input on that
README updates