Repository navigation
refactor: add fontVariables flag to control font CSS variable generation - #669
Conversation
- Add optional fontVariables parameter to ChaiPageStyles component (defaults to false) - Update getChaiThemeCssVariables to accept object with theme and fontVariables flag - Add fontsInTheme feature flag to ChaiBuilderEditorProps - Conditionally render Typography section in ThemeConfigPanel based on fontsInTheme flag - Use dangerouslySetInnerHTML consistently for style tags - Update type imports to use ChaiTheme instead of ChaiBuilderThemeValues
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
sdk | 4912ba6 | Feb 04 2026, 10:01 AM |
There was a problem hiding this comment.
Pull request overview
This PR implements a feature flag system to control font CSS variable generation in theme configuration. The primary goal is to make font configuration opt-in (defaulting to false) to give users control over whether font CSS variables are included in the generated output.
Changes:
- Added
fontsInThemeflag toChaiBuilderEditorPropsto control font configuration UI visibility - Modified
getChaiThemeCssVariablesto accept an object parameter withthemeandfontVariablesproperties - Updated type imports to use
ChaiThemeinstead of the deprecatedChaiBuilderThemeValuesalias - Conditionally render Typography section in ThemeConfigPanel based on the
fontsInThemeflag - Applied consistent use of
dangerouslySetInnerHTMLfor style tag rendering
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/types/chaibuilder-editor-props.ts |
Adds fontsInTheme optional boolean flag to feature flags interface |
src/routes/page-preview.tsx |
Updates to use new API signature with object parameter, passes fontVariables: true |
src/routes/builder.tsx |
Enables fontsInTheme: true flag in demo builder configuration |
src/core/components/sidepanels/panels/theme-configuration/ThemeConfigPanel.tsx |
Conditionally renders Typography section based on fontsInTheme flag |
src/core/components/css-theme-var.tsx |
Updates type imports and hardcodes fontVariables: true when calling theme function |
src/core/components/chaibuilder-editor.tsx |
Updates type import from ChaiBuilderThemeValues to ChaiTheme |
src/core/components/canvas/static/chai-theme-helpers.ts |
Refactors getChaiThemeCssVariables to accept object with theme and fontVariables parameters |
frameworks/nextjs/package/rsc/chai-page-styles.tsx |
Adds optional fontVariables parameter (defaults to false), updates to use new API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fontVariables && | ||
| theme.fontFamily && | ||
| Object.entries(theme.fontFamily) | ||
| .map(([key, value]) => `--font-${key}: ${getFontFamily(value)};`) | ||
| .join("\n ") |
There was a problem hiding this comment.
When fontVariables is false, the expression will evaluate to false and be converted to the string "false" in the template literal, resulting in invalid CSS containing the literal text "false". The expression should return an empty string when the condition is not met. Consider using a ternary operator: fontVariables && theme.fontFamily ? Object.entries(theme.fontFamily).map(...).join(...) : ""
| fontVariables && | |
| theme.fontFamily && | |
| Object.entries(theme.fontFamily) | |
| .map(([key, value]) => `--font-${key}: ${getFontFamily(value)};`) | |
| .join("\n ") | |
| fontVariables && theme.fontFamily | |
| ? Object.entries(theme.fontFamily) | |
| .map(([key, value]) => `--font-${key}: ${getFontFamily(value)};`) | |
| .join("\n ") | |
| : "" |
| theme: ChaiTheme; | ||
| fontVariables?: boolean; | ||
| }) => { | ||
| const chaiTheme = theme; |
There was a problem hiding this comment.
The variable chaiTheme is assigned from theme parameter but serves no purpose. Consider removing this redundant assignment and using theme directly throughout the function.
fix #668 668