Skip to content

docs: add prev/next navigation to guide doc pages - #14

Merged
shijistar merged 6 commits into
masterfrom
feature/docs-prev-next
Aug 8, 2026
Merged

docs: add prev/next navigation to guide doc pages#14
shijistar merged 6 commits into
masterfrom
feature/docs-prev-next

Conversation

@shijistar

@shijistar shijistar commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Add previous/next navigation to the four guide doc pages (Introduce, Install, Get Started, Changelog) so readers can browse the documentation sequentially.

Changes

  • Append a static previous/next markdown table to each guide page (d7f01cd)
  • Refactor into a bottom navigator rendered through lazy-docs.tsx + preview.css with bilingual labels (en-US/zh-CN) (cc7fbd7)
  • Update navigation links and translations across localized MDX files and locale files (5cf8d49)
  • Add remark-gfm dev dependency; replace preview-head.html with preview.css

Files

16 files changed, +703 / -18: .storybook/docs-localized/*.mdx, .storybook/lazy-docs.tsx, .storybook/main.ts, .storybook/preview.tsx, .storybook/preview.css, .storybook/locales/langs/*.ts, package.json.

Verification

  • Storybook build passes; navigation renders correctly on all 4 doc pages in both en-US and zh-CN (browser-verified in the initial implementation round)
  • CI will run on this PR

Summary by CodeRabbit

  • New Features

    • Added previous/next navigation across Storybook documentation pages.
    • Added English and Simplified Chinese labels for navigation, demos, and introductory states.
    • Added localized navigation links for key getting-started and installation guides.
  • Style

    • Improved Storybook documentation spacing and table presentation.
    • Updated the Chinese language selector label to “简体中文”.
  • Documentation

    • Enabled improved Markdown support, including GitHub-flavored Markdown formatting.

Follow enum-plus convention: append a static markdown table
(Previous | Next) at the bottom of each guide doc page
(Introduce/Install/Get Started/Changelog), linking via
?path=/docs/<story>--api with lang:zh-CN globals for CN docs.

- Introduce: prev placeholder (- -), next -> Install
- Install: prev -> Introduce, next -> Get Started
- Get Started: prev -> Install, next -> Changelog
- Changelog: prev -> Get Started, next placeholder (- -)
Copilot AI lite review requested due to automatic review settings August 8, 2026 12:53
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@shijistar, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 39 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 31eb4c56-9c80-4e40-aecd-93da5aae4b81

📥 Commits

Reviewing files that changed from the base of the PR and between 5cf8d49 and 4be89db.

📒 Files selected for processing (5)
  • .storybook/components/StoryDocPage.tsx
  • .storybook/components/ThemedDocsContainer.tsx
  • .storybook/docs/Changelog.mdx
  • .storybook/preview.css
  • .storybook/preview.tsx
📝 Walkthrough

Walkthrough

Storybook documentation now includes localized previous/next navigation, story-based navigation for component pages, GitHub-Flavored Markdown support, and updated documentation styling and locale labels.

Changes

Storybook documentation updates

Layer / File(s) Summary
Configure documentation rendering
.storybook/main.ts, .storybook/preview.css, .storybook/preview.tsx, package.json
Storybook enables remark-gfm, loads documentation styles, updates table presentation, and changes the Chinese toolbar label to 简体中文.
Build localized story navigation
.storybook/lazy-docs.tsx, .storybook/locales/langs/*
DocsPage resolves the current story, builds navigation metadata, renders localized previous/next links, and handles start and end states.
Add navigation to documentation pages
.storybook/docs-localized/*, .storybook/docs/Changelog.mdx
English and Chinese documentation pages add previous/next navigation tables. The changelog links to “Get Started” as its previous page.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant DocsPage
  participant StoryIndex
  participant StorybookLink
  Browser->>DocsPage: Open story URL
  DocsPage->>StoryIndex: Resolve component, hook, and utility stories
  StoryIndex-->>DocsPage: Return navigation metadata
  DocsPage->>StorybookLink: Render localized previous/next links
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding previous/next navigation to guide documentation pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/docs-prev-next

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.storybook/docs-localized/GetStarted.en-US.mdx:
- Around line 61-63: Update the next-link target in
.storybook/docs-localized/GetStarted.en-US.mdx lines 61-63 to the Changelog
story with the en-US global. Apply the corresponding change in
.storybook/docs-localized/GetStarted.zh-CN.mdx lines 61-63, using the zh-CN
global instead of the BreakLines target.

In @.storybook/lazy-docs.tsx:
- Around line 23-45: Update the navigation lookup around currentStory,
allStories, and findIndex so guide routes without a matching story do not throw.
Only build and validate component, hook, or utility story navigation when
currentStory matches a supported story route; otherwise allow guide
documentation such as introduce, install, get-started, and changelog to render
without the lookup.

In @.storybook/preview.css:
- Around line 18-35: Move the generic `#storybook-docs` table:last-child td rule
before the td:first-child and td:last-child rules, preserving its font-weight
and font-size declarations so Stylelint selector-order checks pass.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bcca3a1b-2cb5-4306-9732-fc6949e528bf

📥 Commits

Reviewing files that changed from the base of the PR and between e75352a and 5cf8d49.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (15)
  • .storybook/docs-localized/GetStarted.en-US.mdx
  • .storybook/docs-localized/GetStarted.zh-CN.mdx
  • .storybook/docs-localized/Install.en-US.mdx
  • .storybook/docs-localized/Install.zh-CN.mdx
  • .storybook/docs-localized/Introduce.en-US.mdx
  • .storybook/docs-localized/Introduce.zh-CN.mdx
  • .storybook/docs/Changelog.mdx
  • .storybook/lazy-docs.tsx
  • .storybook/locales/langs/en-US.ts
  • .storybook/locales/langs/zh-CN.ts
  • .storybook/main.ts
  • .storybook/preview-head.html
  • .storybook/preview.css
  • .storybook/preview.tsx
  • package.json
💤 Files with no reviewable changes (1)
  • .storybook/preview-head.html

Comment on lines +61 to +63
| Previous | Next |
| -------------------------------------------------------- | ------------------------------------------------------------------------- |
| [← Install](?path=/docs/install--api&globals=lang:en-US) | [BreakLines →](?path=/docs/components-breaklines--api&globals=lang:en-US) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Link Get Started to Changelog.

Both next links bypass the final guide page and open the BreakLines component story. This breaks the declared sequence: Introduce, Install, Get Started, Changelog.

  • .storybook/docs-localized/GetStarted.en-US.mdx#L61-L63: replace the BreakLines target with ?path=/docs/changelog--api&globals=lang:en-US.
  • .storybook/docs-localized/GetStarted.zh-CN.mdx#L61-L63: replace the BreakLines target with ?path=/docs/changelog--api&globals=lang:zh-CN.
📍 Affects 2 files
  • .storybook/docs-localized/GetStarted.en-US.mdx#L61-L63 (this comment)
  • .storybook/docs-localized/GetStarted.zh-CN.mdx#L61-L63
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.storybook/docs-localized/GetStarted.en-US.mdx around lines 61 - 63, Update
the next-link target in .storybook/docs-localized/GetStarted.en-US.mdx lines
61-63 to the Changelog story with the en-US global. Apply the corresponding
change in .storybook/docs-localized/GetStarted.zh-CN.mdx lines 61-63, using the
zh-CN global instead of the BreakLines target.

Comment thread .storybook/lazy-docs.tsx Outdated
Comment thread .storybook/preview.css Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enhances the Storybook documentation experience by adding previous/next navigation to the guide docs (Introduce/Install/Get Started/Changelog) and introducing a bottom navigator in the custom Storybook DocsPage, supported by GFM table rendering and new styling.

Changes:

  • Added prev/next navigation blocks to localized guide MDX pages and the Changelog page.
  • Introduced a bottom navigator in .storybook/lazy-docs.tsx with i18n labels, plus global docs CSS styling via .storybook/preview.css.
  • Enabled GitHub-flavored markdown tables in Storybook MDX via remark-gfm, and migrated inline head styles into preview.css.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
package.json Adds remark-gfm to support GFM tables in Storybook MDX.
package-lock.json Locks remark-gfm and its transitive dependencies.
.storybook/main.ts Configures @storybook/addon-docs MDX compilation to use remark-gfm.
.storybook/preview.tsx Loads preview.css and updates the zh-CN toolbar label.
.storybook/preview.css Adds global docs styling, including formatting for the bottom navigation table.
.storybook/preview-head.html Removes inline docs padding CSS (moved to preview.css).
.storybook/lazy-docs.tsx Adds a bottom prev/next navigator for API docs pages with i18n labels.
.storybook/locales/langs/en-US.ts Adds translations for docs navigator labels.
.storybook/locales/langs/zh-CN.ts Adds translations for docs navigator labels.
.storybook/docs/Changelog.mdx Appends a prev/next navigation table under the changelog.
.storybook/docs-localized/Introduce.en-US.mdx Appends guide navigation table (Introduce → Install).
.storybook/docs-localized/Introduce.zh-CN.mdx Appends guide navigation table (介绍 → 安装).
.storybook/docs-localized/Install.en-US.mdx Appends guide navigation table (Introduce ↔ Get Started).
.storybook/docs-localized/Install.zh-CN.mdx Appends guide navigation table (介绍 ↔ 快速开始).
.storybook/docs-localized/GetStarted.en-US.mdx Appends guide navigation table (currently points to BreakLines).
.storybook/docs-localized/GetStarted.zh-CN.mdx Appends guide navigation table (currently points to BreakLines).
Suppressed comments (3)

.storybook/lazy-docs.tsx:78

  • Avoid @ts-expect-error + unsupported style prop on the next link as well; keep LinkTo props type-safe by styling a child element.
        {index < allStories.length - 1 ? (
          // @ts-expect-error: because style props exists but not exposed
          <LinkTo kind={allStories[index + 1].url} story="api" style={{ fontSize: 18, fontWeight: 600 }}>
            {allStories[index + 1].name} →

.storybook/lazy-docs.tsx:40

  • LinkTo expects kind to match the Storybook story title (e.g. Components/BreakLines, Hooks/useDebounce). Building url as components/BreakLines (lowercase group) will not match existing story titles, so prev/next navigation won’t resolve.
  const allStories = useMemo(
    () =>
      [...componentPaths, ...hookPaths, ...utilPaths].map((path) => {
        const parts = path.split('/');
        return {
          path: path.toLowerCase(),
          name: parts[3],

.storybook/lazy-docs.tsx:72

  • The fallback previous link uses kind="get-started", but Storybook kinds are the title strings (here the guide page title is Get Started). Using the slug will prevent LinkTo from navigating.
        ) : (
          // @ts-expect-error: because style props exists but not exposed
          <LinkTo kind="get-started" story="api" style={{ fontSize: 18, fontWeight: 600 }}>
            ← {t('storybook.stories.nav.getStarted')}

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .storybook/lazy-docs.tsx
Comment on lines +23 to +30
const currentStory = useMemo(() => {
const path = new URLSearchParams(top?.location.search).get('path');
const matches = path?.match(/\/docs\/(components|hooks|utils)-(\w+?)--api/);
if (matches && matches.length > 2) {
return `./stories/${matches[1]}/${matches[2]}/index.stories.tsx`;
}
return null;
}, []);
Comment thread .storybook/lazy-docs.tsx Outdated
Comment on lines +64 to +67
// @ts-expect-error: because style props exists but not exposed
<LinkTo kind={allStories[index - 1].url} story="api" style={{ fontSize: 18, fontWeight: 600 }}>
← {allStories[index - 1].name}
</LinkTo>

| 上一篇 | 下一篇 |
| ----------------------------------------------------- | ------------------------------------------------------------------------- |
| [← 安装](?path=/docs/install--api&globals=lang:zh-CN) | [BreakLines →](?path=/docs/components-breaklines--api&globals=lang:zh-CN) |

| Previous | Next |
| -------------------------------------------------------- | ------------------------------------------------------------------------- |
| [← Install](?path=/docs/install--api&globals=lang:en-US) | [BreakLines →](?path=/docs/components-breaklines--api&globals=lang:en-US) |
Comment thread .storybook/docs/Changelog.mdx Outdated

| Previous | Next |
| --------------------------------------------- | ----- |
| [← Get Started](?path=/docs/get-started--api) | \- \- |
@shijistar
shijistar merged commit 005b9bd into master Aug 8, 2026
3 checks passed
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.

2 participants