Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤖 Generated by Copilot at be89da5
Summary
🖱️🌐🛠️
This pull request enhances the
HomeHeader
component for the website by improving its language switching and home page redirection features, refactoring and simplifying its code, and adding a cursor style to the language switcher icon. It affects the filesdocs/website/src/pages/components/Header/index.tsx
,docs/website/src/pages/self-hosting/header/index.tsx
, anddocs/website/src/pages/self-hosting/header/index.scss
.Walkthrough
i18nMap
object to use thedefaultLocale
andcurrentLocale
values from theuseDocusaurusContext
hook in theHomeHeader
component in bothcomponents/Header/index.tsx
andself-hosting/header/index.tsx
files (link, link)onClick
handler for the logo image to use thedefaultLocale
andcurrentLocale
values to construct the URL for redirecting to the home page in theHomeHeader
component in bothcomponents/Header/index.tsx
andself-hosting/header/index.tsx
files (link, link)onClick
handler for the language switcher icon to use thelink
property from thei18nMap
object in theHomeHeader
component in bothcomponents/Header/index.tsx
andself-hosting/header/index.tsx
files (link, link)cursor: pointer
style to the.i18nIcon
class in theheader/index.scss
file to improve the user experience by indicating that the language switcher icon is clickable (link)useLocation
hook from@docusaurus/router
to access the current location object in theHomeHeader
component in thecomponents/Header/index.tsx
file. This is needed to construct the correct URL for switching languages and redirecting to the home page (link)