Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add language selector to site header #3622

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

Merged
zenoachtig merged 7 commits into main from language-selector
Sep 5, 2025
Merged

Add language selector to site header #3622

zenoachtig merged 7 commits into main from language-selector
Sep 5, 2025

Conversation

Copy link
Contributor

@zenoachtig zenoachtig commented Sep 3, 2025
edited
Loading

  • Rework the isMultiVariants property into a more comprehensive withVariants: "generic" | "translations" | undefined. This way simple checks can still be made against it (useful for search) but more specific checks on the type of variants can also be made.

    Screenshot 2025年09月04日 at 15 09 44
  • Restyle the SpacesDropdown to use a <Button> instead of a custom component.

    • Translations variants get a SpacesDropdown with a globe 🌐 icon prepended to it. If the variant (= translation) starts with an emoji, we don't show the globe icon as we assume there's a flag to represent the language instead.

Fixes RND-8021, RND-5840

Copy link

changeset-bot bot commented Sep 3, 2025
edited
Loading

🦋 Changeset detected

Latest commit: 564a2b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
gitbook Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

argos-ci bot commented Sep 3, 2025
edited
Loading

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2 (Inspect) 👍 Changes approved 41 changed Sep 5, 2025, 12:10 PM
v2-cloudflare (Inspect) 👍 Changes approved 118 changed Sep 5, 2025, 12:14 PM
v2-vercel (Inspect) 👍 Changes approved 119 changed Sep 5, 2025, 12:13 PM

Copy link

linear bot commented Sep 4, 2025

Copilot

This comment was marked as outdated.

Copy link

linear bot commented Sep 4, 2025

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds language selector functionality to the site header by reworking the variant system to distinguish between generic variants (shown in TOC) and translation variants (shown in header).

  • Replaces isMultiVariants boolean with a more comprehensive withVariants: "generic" | "translations" | undefined property
  • Positions translation variants in the site header (either next to sections or header links) while keeping generic variants in the TOC
  • Refactors SpacesDropdown to use Button component and adds a new TranslationsDropdown with globe icon

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/gitbook/tailwind.config.ts Comments out CSS variant for page-no-toc with variants
packages/gitbook/src/components/primitives/styles.ts Adds button state styling for open dropdowns
packages/gitbook/src/components/primitives/DropdownMenu.tsx Removes margin from dropdown chevron
packages/gitbook/src/components/primitives/Button.tsx Exports ButtonProps type and adds styling classes for button icons
packages/gitbook/src/components/TableOfContents/TableOfContents.tsx Updates CSS positioning for outline elements
packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx Implements withVariants logic and updates variant positioning
packages/gitbook/src/components/RootLayout/globals.css Adds site-background utility class
packages/gitbook/src/components/RootLayout/CustomizationRootLayout.tsx Uses new site-background utility class
packages/gitbook/src/components/Header/SpacesDropdown.tsx Refactors to use Button component and adds TranslationsDropdown
packages/gitbook/src/components/Header/HeaderLink.tsx Adds gap spacing to header link items
packages/gitbook/src/components/Header/Header.tsx Integrates translation variants in header layout
.changeset/four-roses-live.md Adds changeset for the feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@zenoachtig zenoachtig enabled auto-merge (squash) September 5, 2025 12:05
@zenoachtig zenoachtig merged commit 7911350 into main Sep 5, 2025
15 of 16 checks passed
@zenoachtig zenoachtig deleted the language-selector branch September 5, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

Copilot code review Copilot Copilot left review comments

@gregberge gregberge gregberge approved these changes

@valentin0h valentin0h Awaiting requested review from valentin0h

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /