Add Lookbook preview for lazy-loaded tab panels#66
Open
joshsadam wants to merge 6 commits into
Open
Conversation
f25e15f to
984fb1e
Compare
cbed100 to
8f4d031
Compare
2dcd848 to
a6b81ed
Compare
MSW intercepts Turbo Frame requests in the Lookbook preview without adding demo-only Rails routes.
Lookbook previews now start MSW before Turbo boots so lazy tab panels can fetch mocked frame responses without demo routes.
…r missing helpers
Lookbook previews use type token classes outside the Tailwind scan path. Inline @source keeps those utilities in the artifact.
Reorder examples, drop redundant advanced_features preview, align surfaces with the design contract, and render preview chrome through Pathogen typography helpers.
…ration Modified the Procfile to use the PORT environment variable for the web server and updated the default port in the dev script to 3001. Cleared the hosts configuration in development.rb to facilitate secure port forwarding with VSCode.
a6b81ed to
0e4b7c5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Lookbook preview demonstrating Pathogen::Tabs#with_lazy_panel with Turbo Frames, using Mock Service Worker (MSW) in the demo app to intercept lazy-frame requests without adding demo-only Rails routes. The PR also refreshes existing Tabs previews to use Pathogen view helpers/typography tokens and adjusts demo wiring to load MSW before Turbo boots.
Changes:
- Add a new “Turbo Frame Lazy Load” preview and MSW handlers/entrypoint to mock
/lookbook-mocks/tabs/lazy-load/:panelframe responses. - Update the demo Lookbook preview layout/importmap and add the MSW service worker asset; add
turbo-railsto the demo app. - Modernize Tabs preview templates (headings, supporting text, lists, typography tokens) and add a LazyPanel fallback test + helper method.
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/components/previews/pathogen/tabs_preview/url_sync.html.erb | Updates preview copy/layout to use Pathogen helpers and new typography tokens. |
| test/components/previews/pathogen/tabs_preview/turbo_frame_lazy_load.html.erb | Adds the new Lookbook preview demonstrating lazy-loaded panels via Turbo Frames + with_lazy_panel. |
| test/components/previews/pathogen/tabs_preview/orientations.html.erb | Refactors orientation demos and adds a “Many tabs” example using Pathogen helpers. |
| test/components/previews/pathogen/tabs_preview/keyboard_and_accessibility.html.erb | Converts headings/descriptive text to Pathogen helpers and adjusts typography tokens. |
| test/components/previews/pathogen/tabs_preview/integration_examples.html.erb | Refreshes integration examples and trims/reshapes sections using Pathogen helpers. |
| test/components/previews/pathogen/tabs_preview/basic_usage.html.erb | Reworks “Overview” content, adds custom default tab + single-tab edge case examples. |
| test/components/previews/pathogen/tabs_preview/advanced_features.html.erb | Removes the old “Advanced Features” preview content (moved/reshaped elsewhere). |
| test/components/previews/pathogen/tabs_preview.rb | Reorganizes preview groups/labels and includes Pathogen::ViewHelper for helper usage. |
| test/components/pathogen/tabs/lazy_panel_test.rb | Adds coverage for LazyPanel rendering fallback when turbo-rails helpers are unavailable. |
| app/components/pathogen/tabs/lazy_panel.rb | Adds render_turbo_frame helper method to support environments with/without turbo_frame_tag. |
| app/components/pathogen/tabs/lazy_panel.html.erb | Uses render_turbo_frame for eager and lazy branches. |
| demo/app/javascript/lookbook_preview.js | New entrypoint that starts MSW before importing the main application (Turbo). |
| demo/app/javascript/lookbook_mocks/tabs_lazy_load.js | MSW handlers that return realistic Turbo Frame HTML with a small artificial delay. |
| demo/app/views/layouts/lookbook_preview.html.erb | Loads a Lookbook-specific importmap entrypoint so MSW can start before Turbo. |
| demo/public/mockServiceWorker.js | Adds the generated MSW service worker used for browser interception. |
| demo/config/importmap.rb | Pins the new JS entrypoints and MSW ESM URLs. |
| demo/Gemfile | Adds turbo-rails to support Turbo helpers in the demo Rails app. |
| demo/config/environments/development.rb | Changes host authorization configuration for dev (currently disables it). |
| demo/Procfile.dev | Adjusts dev server bind/port behavior. |
| demo/bin/dev | Defaults PORT to 3001 for the demo dev script. |
| eslint.config.js | Adds an ESLint config block for demo JavaScript files (browser/module context). |
| package.json | Adds MSW as a dev dependency and configures MSW worker output directory. |
| pnpm-lock.yaml | Locks MSW and its transitive dependencies. |
| app/assets/stylesheets/pathogen.tailwind.css | Anchors new Tailwind arbitrary length utilities used by updated previews. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+45
to
+46
| # the following settings allow us to forward ports securely using vscode remote port forwarding | ||
| config.hosts.clear |
| @@ -1,3 +1,3 @@ | |||
| web: bin/rails server -p 3001 | |||
| web: bin/rails server -p $PORT -b 0.0.0.0 | |||
| "eslint-config-prettier": "^10.0.0", | ||
| "globals": "^17.7.0", | ||
| "jsdom": "^29.1.1", | ||
| "msw": "^2.14.6", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do and why?
Adds a new Lookbook preview that demonstrates lazy-loaded tab panels using
Pathogen::Tabs#with_lazy_paneland Turbo Frames.The preview shows a three-tab layout where the selected panel renders immediately and the other panels fetch mocked Turbo Frame responses when their tabs become visible. To support this without adding demo-only Rails routes, the Lookbook preview layout now boots MSW (Mock Service Worker) before Turbo starts. MSW intercepts requests to
/lookbook-mocks/tabs/lazy-load/:paneland returns realistic frame HTML with a short artificial delay.Changes include:
Pathogen::Tabslookbook_mocks/tabs_lazy_load.jsMSW handlers andlookbook_preview.jsentry pointmockServiceWorker.jsindemo/public/for browser interceptionpackage.json,pnpm-lock.yaml)Screenshots or screen recordings
Requests:

How to set up and validate locally
bin/setupcd demo&bin/devPR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.