Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

feat(svelte): Add search query syntax introduction#63753

Merged
fkling merged 2 commits into
mainfrom
fkling-srch-494-search-language-intro
Jul 10, 2024
Merged

feat(svelte): Add search query syntax introduction#63753
fkling merged 2 commits into
mainfrom
fkling-srch-494-search-language-intro

Conversation

@fkling

@fkling fkling commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

Closes srch-494

This adds the search query syntax introduction component to the search homepage. I tried to replicate the React version as closely as possible.

I originally wanted to reuse the logic to generate the example sections but since it had dependencies on wildcard I duplicated it instead.

Notable additional changes:

  • Added a value method to the temporary settings store to make it easier to get the current value of the settings store. It only resolves (or rejects) once the data is loaded.
  • Extended the tabs component to not show the tab header if there is only a single panel. This makes it easier for consumers to render tabs conditionally.
  • Added the ProductStatusBadge component
  • Various style adjustments

For reference, the relevant parts of the React version are in https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/branded/src/search-ui/components/useQueryExamples.tsx and https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/branded/src/search-ui/components/QueryExamples.tsx

Comparison between React and Svelte:

Env React Svelte
enterprise 2024-07-10_15-51 2024-07-10_15-51_1
dotcom 2024-07-10_15-51_2 2024-07-10_15-52

Test plan

Manual testing. I manually set the value received from temporary settings to null (in code) to force trigger the compute logic.

This adds the search query syntax introduction component to the search
homepage. I tried to replicate the React version as closely as possible.

I originally wanted to reuse the logic to generate the example sections
but since it had depdencies on wildcard I duplicated it instead.

Noteable additional changes:
- Added a `value` method to the temporary settings store to make it
  easier to get the current value of the settings store. It only
  resolves (or rejects) once the data is loaded.
- Extended the tabs component to not show the tab header if there is
  only a single panel. This makes it easier for consumers to render tabs
  conditionally.
- Added the `ProductStatusBadge` compontent
- Various style adjustments
@fkling fkling self-assigned this Jul 10, 2024
@cla-bot cla-bot Bot added the cla-signed label Jul 10, 2024

@camdencheek camdencheek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great!

Comment thread client/web-sveltekit/src/lib/temporarySettings.ts
Comment thread client/web-sveltekit/src/lib/wildcard/ProductStatusBadge.svelte
.tabs-header {
--icon-color: var(--header-icon-color);

width: 100%;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looksl like this caused the Hide button to wrap

screenshot-2024-07-10_08-28-02@2x

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll take a look.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reverted the change and instead used :global([data-tab-header]) to set the width. I made some changes to the tabs component to avoid this in the future and clean up the CSS a bit.

Comment thread client/web-sveltekit/src/lib/temporarySettings.ts
Comment thread client/web-sveltekit/src/routes/search/+page.ts
@fkling fkling merged commit 6819363 into main Jul 10, 2024
@fkling fkling deleted the fkling-srch-494-search-language-intro branch July 10, 2024 20:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants