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

DOP-4715: Upgrade consistent nav to "v2.1.0" #1108

Merged
merged 5 commits into from
Jun 3, 2024
Merged

DOP-4715: Upgrade consistent nav to "v2.1.0" #1108

merged 5 commits into from
Jun 3, 2024

Conversation

mayaraman19
Copy link
Collaborator

@mayaraman19 mayaraman19 commented Jun 3, 2024

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 the locale.js file to reduce duplication.

You can test locally by setting COMMIT_HASH as one of the enabledLocales (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

    • This PR introduces changes that should be reflected in the README, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README

@mayaraman19 mayaraman19 marked this pull request as ready for review June 3, 2024 15:50
Copy link
Collaborator

@rayangler rayangler left a 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

Comment on lines 145 to 146
const location = window.location;
if (isBrowser) {
Copy link
Collaborator

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

@mayaraman19 mayaraman19 merged commit 1d7b309 into main Jun 3, 2024
2 checks passed
@mayaraman19 mayaraman19 deleted the DOP-4715-b branch June 3, 2024 20:16
mayaraman19 added a commit that referenced this pull request Jun 7, 2024
@mayaraman19 mayaraman19 restored the DOP-4715-b branch June 24, 2024 15:59
@mayaraman19 mayaraman19 deleted the DOP-4715-b branch June 24, 2024 16:00
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