Add config option to hide theme switch#2414
Conversation
|
Someone is attempting to deploy a commit to the Zuplo Team on Vercel. A member of the Team first needs to authorize it. |
|
Preview build of published Zudoku package Warning This PR is from an external contributor. To run the public package build workflow, a maintainer must add the |
There was a problem hiding this comment.
Pull request overview
Adds a new header.showThemeSwitch configuration option to let consumers hide the light/dark theme toggle while preserving existing default behavior (visible unless explicitly disabled).
Changes:
- Extend config/types to include
header.showThemeSwitch?: boolean. - Conditionally render
ThemeSwitchin both the desktop header and mobile navigation drawer based on the new flag. - Document the new configuration option.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/zudoku/src/lib/core/ZudokuContext.ts | Adds showThemeSwitch to the in-app header options type. |
| packages/zudoku/src/lib/components/MobileTopNavigation.tsx | Hides the theme switch in the mobile drawer when configured. |
| packages/zudoku/src/lib/components/Header.tsx | Hides the theme switch in the desktop header when configured. |
| packages/zudoku/src/config/validators/ZudokuConfig.ts | Adds schema/type support for header.showThemeSwitch. |
| packages/zudoku/src/app/main.tsx | Passes showThemeSwitch from validated config into runtime options. |
| docs/pages/docs/configuration/overview.md | Documents the new header.showThemeSwitch option and its default. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e69e3f5 to
c239afd
Compare
c239afd to
f32d2d3
Compare
|
Hey @oksiweb - congrats on your first PR - looking good! Can we just rename this to |
fixed |
| this.options = { | ||
| ...options, | ||
| header: { | ||
| ...options.header, | ||
| themeSwitcher: { | ||
| ...options.header?.themeSwitcher, | ||
| enabled: options.header?.themeSwitcher?.enabled ?? true, | ||
| }, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Avoid the nested-spread default injection. Default at the consumer instead (see suggestions on Header.tsx and MobileTopNavigation.tsx).
| this.options = { | |
| ...options, | |
| header: { | |
| ...options.header, | |
| themeSwitcher: { | |
| ...options.header?.themeSwitcher, | |
| enabled: options.header?.themeSwitcher?.enabled ?? true, | |
| }, | |
| }, | |
| }; | |
| this.options = options; |
Head branch was pushed to by a user without write access
b856d11 to
990514c
Compare
990514c to
7048b38
Compare
7048b38 to
e355917
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Changes
header.themeSwitcher.enabledconfig option.header.themeSwitcher.enabledis set tofalse, the light/dark theme switch is hidden from both the desktop header and the mobile navigation drawer.true, so existing sites keep the current behavior.How to test
Set the option in
zudoku.config.tsx:Then run:
You can also run the example locally:
Expected successful behavior
Unexpected behavior