Skip to content

New Gallery search for sandcastle #12755

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

Open
wants to merge 6 commits into
base: stratakit-ui
Choose a base branch
from
Open

Conversation

jjspace
Copy link
Contributor

@jjspace jjspace commented Jul 21, 2025

Description

Re-implement searching for sandcastles in the Gallery using pagefind.

Pagefind is primarily targeted at indexing static html files. We need to build our own custom indexes so it can search in the JS code. I've looped this into the script that already builds the gallery list of metadata. I've also chosen to store the build output inside the gallery directory so the FE can be pointed at a single "gallery path" and load everything it needs for search and the list and assets. (Eventually we will need to support multiple galleries but this is not part of this PR)

When pagefind builds an index it also builds the JS module we should import for that index. This makes vite (and TS) a bit upset because it doesn't know where the files are. We need to do a dynamic import and tell vite to ignore it to actually load the pagefind web module. I encapsulated all this logic in the GallerySearch component to keep it all in one place.

Issue number and link

Part of #12566

Testing plan

  • run npm run dev in the package or npm run build-sandcastle and npm start from the project root
  • Search for something in the gallery. Test multiple terms, including ones that have no results
  • Test the dropdown for filtering tags. Make sure it works with a search term and without
  • If you want to test with all the sandcastles copy the convertGallery.js script into packages/sandcastle/scripts and run it. This will generate all the other sandcastles and re-running the build scripts will index them all.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

@jjspace jjspace requested a review from ggetz July 21, 2025 20:33
Copy link

Thank you for the pull request, @jjspace!

✅ We can confirm we have a CLA on file for you.

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.

1 participant