Skip to content

fix(storybook): dark background for docs component previews#115

Merged
yahyafakhroji merged 1 commit into
mainfrom
fix/storybook-docs-darkmode-container
Jun 4, 2026
Merged

fix(storybook): dark background for docs component previews#115
yahyafakhroji merged 1 commit into
mainfrom
fix/storybook-docs-darkmode-container

Conversation

@yahyafakhroji

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the docs-consolidation work. In dark mode the docs component preview now uses a dark background (matching the dark-rendered component), while the rest of the docs chrome stays light — avoiding the light-prose/dark-page clash.

  • Removes the custom DocsContainer (themed-docs-container.tsx). It read the theme via the useGlobals preview hook, which isn't valid in the docs container's render context and threw "combining Storybook hooks with framework hooks" at runtime; it also themed the whole docs page, which looked broken against the light prose and tables.
  • Adds a targeted CSS rule: html.dark .sbdocs-preview, html.dark .docs-story { background-color: #0c1d31 }. The existing preview decorator already sets .dark on the docs root in dark mode, so only the preview surface darkens.

Verification (Chrome, local)

  • Dark mode: preview box dark (#0c1d31) with the dark component; title/prose/args-table stay light. ✓
  • Light mode: preview box white with the light component; no regression. ✓

Changeset

@repo/storybook patch (2.0.0 → 2.0.1).

Test plan

  • pnpm --filter @repo/storybook typecheck — passes
  • Verified light + dark docs preview in a browser
  • Manual confirm: toggle the Theme toolbar on a Docs tab (URL globals params are buggy for the toolbar; use the toolbar toggle)

In dark mode the docs component preview now uses a dark background to
match the dark-rendered component, while the rest of the docs chrome
stays light. Removes the custom DocsContainer, which threw a 'combining
Storybook hooks with framework hooks' runtime error and themed the whole
docs page (clashing with light prose and tables).
@yahyafakhroji yahyafakhroji requested a review from a team June 4, 2026 11:44
@yahyafakhroji yahyafakhroji merged commit d48b3f8 into main Jun 4, 2026
8 checks passed
@yahyafakhroji yahyafakhroji deleted the fix/storybook-docs-darkmode-container branch June 4, 2026 11:54
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