-
Notifications
You must be signed in to change notification settings - Fork 4k
Scope search across sections and variants #3640
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
base: main
Are you sure you want to change the base?
Scope search across sections and variants #3640
Conversation
**Components:** - Add `data-active` to `Button` to make styling easier - Improve active style for blank buttons in `contrast-more` mode - Add leading icon to `DropdownMenuItem`, to be further standardised in other places in follow-up PR - Create `SegmentedControl` component that styles buttons to look like one big selector. **Search**: - Rework `global` search parameter into two separate ones to determine search scope: - `scope: all | current`: how "wide" to search on the site. Determines section scope. - `depth: single | full`: how "deep" to search within the scope. This determines the variant scope within sections. - Change `SearchScopeToggle` to use new scope & depth params and segmented control to show a UI to switch between scopes.
🦋 Changeset detectedLatest commit: 1bf0682 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
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.
Just need to add new string translations
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.
Pull Request Overview
This PR refactors the search functionality to provide more granular control over search scope across site sections and variants. It replaces the simple boolean global
parameter with two new parameters (scope
and depth
) and introduces a new segmented control UI component.
- Replaces boolean
global
search parameter withscope
(all
/current
) anddepth
(single
/full
) parameters - Creates new
SegmentedControl
component for improved search scope selection UI - Adds
leadingIcon
support toDropdownMenuItem
anddata-active
attribute toButton
components
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages/gitbook/src/components/primitives/SegmentedControl.tsx | New component providing segmented control UI for search scope selection |
packages/gitbook/src/components/primitives/DropdownMenu.tsx | Adds leading icon support and increases z-index |
packages/gitbook/src/components/primitives/Button.tsx | Adds data-active attribute and improves styling |
packages/gitbook/src/components/Search/useSearch.tsx | Replaces global boolean with scope/depth parameters |
packages/gitbook/src/components/Search/server-actions.tsx | Refactors search functions to handle new scope parameters |
packages/gitbook/src/components/Search/SearchScopeToggle.tsx | Complete rewrite using SegmentedControl component |
packages/gitbook/src/components/Search/SearchResults.tsx | Updates to use new scope/depth parameters |
packages/gitbook/src/components/Search/SearchContainer.tsx | Updates prop interface and search logic |
packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx | Updates SearchContainer props |
packages/gitbook/src/components/Header/Header.tsx | Updates SearchContainer props |
packages/gitbook/src/components/AI/useAIChat.tsx | Updates to use new search parameters |
packages/gitbook/src/components/AI/useAI.tsx | Updates to use new search parameters |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Pull Request Overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Components
data-active
toButton
to make styling easiercontrast-more
modeDropdownMenuItem
, to be further standardised in other places in follow-up PRSegmentedControl
component that styles buttons to look like one big selector.Search
global
search parameter into two separate ones to determine search scope:scope: all | current
: how "wide" to search on the site. Determines section scope.depth: single | full
: how "deep" to search within the scope. This determines the variant scope within sections.SearchScopeToggle
to use new scope & depth params and segmented control to show a UI to switch between scopes.Demo
CleanShot.2025-09-10.at.17.26.59.mp4