-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support custom background colors for sidebar and header #4151
Conversation
|
WalkthroughThe recent updates across various components enhance theme customization and user interface flexibility. New properties like Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Preferences
participant UI
participant ThemeManager
User->>Preferences: Change theme settings
Preferences->>ThemeManager: Update theme preferences (semiDarkHeader, headerTheme)
ThemeManager->>UI: Refresh UI with new theme
UI-->>User: Display updated theme
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (6)
packages/@core/preferences/src/config.ts (1)
93-93
: Usage ofsemiDarkHeader
is limited to its definition and declaration.The
semiDarkHeader
property is defined inconfig.ts
and declared intypes.ts
, but it is not used elsewhere in the codebase. Consider integrating this property where necessary to ensure it fulfills its intended purpose.
packages/@core/preferences/src/config.ts
: Definitionpackages/@core/preferences/src/types.ts
: DeclarationAnalysis chain
LGTM! Verify usage of
semiDarkHeader
.The addition of
semiDarkHeader
todefaultPreferences
looks good and aligns with the theme customization objectives. Ensure that this new property is utilized correctly throughout the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `semiDarkHeader` in the codebase. # Test: Search for occurrences of `semiDarkHeader` to ensure it's being used correctly. rg --type ts 'semiDarkHeader'Length of output: 164
packages/@core/ui-kit/layout-ui/src/vben-layout.ts (1)
75-78
:headerTheme
is currently unused in the codebase. TheheaderTheme
property added toVbenLayoutProps
is not utilized within theuseLayout
function or elsewhere in the codebase. Consider integrating this property into the relevant components or logic to ensure it enhances the layout's configurability as intended.Analysis chain
LGTM! Verify usage of
headerTheme
.The addition of
headerTheme
toVbenLayoutProps
enhances the layout's configurability. Ensure that this new property is utilized correctly throughout the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `headerTheme` in the codebase. # Test: Search for occurrences of `headerTheme` to ensure it's being used correctly. rg --type ts 'headerTheme'Length of output: 108
Script:
#!/bin/bash # Description: Search for occurrences of `VbenLayoutProps` to check if `headerTheme` is indirectly used. # Test: Search for occurrences of `VbenLayoutProps` in the codebase. rg --type ts 'VbenLayoutProps'Length of output: 412
Script:
#!/bin/bash # Description: Search for the implementation of `useLayout` function to check the usage of `headerTheme`. # Test: Retrieve the implementation of `useLayout` function. ast-grep --lang typescript --pattern $'export function useLayout(props: VbenLayoutProps) { $$$ }'Length of output: 2899
docs/src/guide/essentials/settings.md (2)
263-263
: Document the newsemiDarkHeader
property.The
semiDarkHeader
property has been added to enhance theme customization. Ensure that its behavior and usage are clearly documented in the guide.+ /** 是否开启半深色header(只在theme='light'时生效) */ + semiDarkHeader: boolean;
456-457
: Ensure consistency in property descriptions.The description for
semiDarkHeader
should be consistent with other properties in terms of style and detail. Consider adding a brief explanation of its effect and when it should be used.+ /** Enables a semi-dark header when the theme is set to 'light'. */ + semiDarkHeader: boolean;packages/@core/base/design/src/design-tokens/default/index.css (1)
92-94
: Consider the implications of adding--header
.The new
--header
property has been added. Ensure that its introduction is consistent with the design system and that it is used appropriately across components.+ /* header color */ + --header: 0 0% 100%;docs/src/guide/in-depth/theme.md (1)
349-349
: Inconsistent--muted
Variable Values DetectedThe
--muted
variable shows multiple inconsistent values across different CSS files. This inconsistency could lead to unexpected design variations depending on which value is applied. Please review and ensure that the--muted
variable is consistent with the intended theme design.
- Files with inconsistent
--muted
values:
packages/@core/base/design/src/design-tokens/dark/index.css
packages/@core/base/design/src/design-tokens/default/index.css
Analysis chain
Verify the updated
--muted
values.The
--muted
variable has been updated to a new color value. Ensure that this change is consistent with the overall theme design and that it is applied correctly throughout the application.Also applies to: 727-727
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and consistency of the updated `--muted` variable. # Test: Search for the `--muted` variable usage. Expect: Consistent values across themes. rg --type css -A 5 $'--muted'Length of output: 472
Script:
#!/bin/bash # Corrected command to search for the `--muted` variable in CSS files. rg --type css -A 5 '--muted'Length of output: 472
Script:
#!/bin/bash # Correct command to search for the `--muted` variable in CSS files. rg --type css -A 5 '\-\-muted'Length of output: 18964
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (19)
- apps/backend-mock/README.md (1 hunks)
- docs/src/guide/essentials/settings.md (2 hunks)
- docs/src/guide/in-depth/theme.md (24 hunks)
- internal/tailwind-config/src/index.ts (1 hunks)
- packages/@core/base/design/src/design-tokens/dark/index.css (14 hunks)
- packages/@core/base/design/src/design-tokens/default/index.css (2 hunks)
- packages/@core/preferences/src/config.ts (1 hunks)
- packages/@core/preferences/src/types.ts (1 hunks)
- packages/@core/ui-kit/layout-ui/src/components/layout-header.vue (2 hunks)
- packages/@core/ui-kit/layout-ui/src/vben-layout.ts (2 hunks)
- packages/@core/ui-kit/layout-ui/src/vben-layout.vue (1 hunks)
- packages/@core/ui-kit/menu-ui/src/components/menu.vue (1 hunks)
- packages/@core/ui-kit/shadcn-ui/src/components/ui/hover-card/HoverCardContent.vue (2 hunks)
- packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue (1 hunks)
- packages/effects/layouts/src/basic/layout.vue (4 hunks)
- packages/effects/layouts/src/widgets/preferences/blocks/theme/theme.vue (2 hunks)
- packages/effects/layouts/src/widgets/preferences/preferences-sheet.vue (2 hunks)
- packages/locales/src/langs/en-US.json (1 hunks)
- packages/locales/src/langs/zh-CN.json (1 hunks)
Files skipped from review due to trivial changes (4)
- apps/backend-mock/README.md
- packages/@core/ui-kit/menu-ui/src/components/menu.vue
- packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue
- packages/locales/src/langs/en-US.json
Additional comments not posted (19)
packages/@core/ui-kit/layout-ui/src/components/layout-header.vue (2)
39-42
: Addition oftheme
prop enhances customization.The introduction of the
theme
prop in theProps
interface allows for dynamic theming, improving flexibility in styling. Ensure that thetheme
values are validated to prevent unexpected styles.
83-85
: Ensuretheme
class values are validated.While the dynamic application of the
theme
class enhances flexibility, ensure that thetheme
values are validated to prevent invalid or harmful CSS classes from being applied.packages/effects/layouts/src/widgets/preferences/blocks/theme/theme.vue (2)
16-17
: Enhancement in theme customization options.The addition of
themeSemiDarkHeader
and the modification ofthemeSemiDarkMenu
provide more granular control over theme settings, enhancing user customization options.
79-81
: Ensure consistent behavior for dark mode toggles.The addition of the
SwitchItem
forthemeSemiDarkHeader
aligns with the existing UI for theme customization. Ensure that the toggles forthemeSemiDarkMenu
andthemeSemiDarkHeader
behave consistently, especially whenmodelValue
is set to 'dark'.Verification successful
Consistent behavior for dark mode toggles verified.
The
themeSemiDarkMenu
andthemeSemiDarkHeader
toggles have consistent logic, both being disabled whenmodelValue
is 'dark'. This aligns with the expected behavior for theme customization.
- The toggles are defined as models and used in
v-model
bindings.- Both toggles have a
:disabled
condition checkingmodelValue === 'dark'
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistent behavior of dark mode toggles. # Test: Search for related logic handling `themeSemiDarkMenu` and `themeSemiDarkHeader`. Expect: Consistent logic handling. rg --type vue 'themeSemiDark(Menu|Header)' -A 5Length of output: 77
Script:
#!/bin/bash # Description: Verify consistent behavior of dark mode toggles. # Find all .vue files and search for related logic handling `themeSemiDarkMenu` and `themeSemiDarkHeader`. fd --extension vue --exec rg 'themeSemiDark(Menu|Header)' -A 5Length of output: 1347
packages/@core/preferences/src/types.ts (1)
186-187
: LGTM! Verify usage ofsemiDarkHeader
.The addition of
semiDarkHeader
toThemePreferences
is consistent with the goal of enhancing theme customization. Ensure that this new property is utilized correctly throughout the codebase.Verification successful
Verified Usage of
semiDarkHeader
: ThesemiDarkHeader
property is used appropriately in thelayout.vue
file to manage theme settings, and it is documented in the settings guide. This confirms its correct integration into the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `semiDarkHeader` in the codebase. # Test: Search for occurrences of `semiDarkHeader` to ensure it's being used correctly. rg --type ts 'semiDarkHeader'Length of output: 164
Script:
#!/bin/bash # Broader search for any related usage or documentation of `semiDarkHeader` rg 'semiDarkHeader' -A 5Length of output: 1921
packages/locales/src/langs/zh-CN.json (1)
240-240
: Translation addition looks good.The new entry for
"darkHeader": "深色顶栏"
correctly adds localization support for the dark header theme.internal/tailwind-config/src/index.ts (1)
83-85
: Addition ofheader
color customization is appropriate.The new
header
color configuration follows the existing pattern and enhances theme customization options.packages/effects/layouts/src/basic/layout.vue (4)
55-58
:headerTheme
computed property is well-implemented.The introduction of
headerTheme
effectively manages the header's theme, improving modularity and responsiveness to user preferences.
165-165
: Integration ofheaderTheme
in template bindings is seamless.The use of
headerTheme
in the template ensures consistent theme application across the header component.
205-205
: Conditional application ofheaderTheme
is correct.Using
headerTheme
conditionally based onshowHeaderNav
ensures the correct theme is applied in different navigation contexts.
227-227
: Use ofheaderTheme
inLayoutMenu
is appropriate.The application of
headerTheme
inLayoutMenu
aligns with the theme management strategy, ensuring visual consistency.packages/@core/base/design/src/design-tokens/default/index.css (1)
11-11
: Verify the impact of the--foreground
color change.The
--foreground
color has been adjusted. Ensure that this change aligns with the overall design goals and does not negatively affect readability or accessibility.Verification successful
The
--foreground
variable is used consistently across themes.The
--foreground
color change to210 6% 21%
in thedefault
theme aligns with the pattern of theme-specific styling observed in the codebase. Ensure that this change maintains readability and meets design goals.
packages/@core/base/design/src/design-tokens/default/index.css
: Multiple instances of--foreground
with varying values for different contexts.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `--foreground` variable to ensure it aligns with design goals. # Test: Search for `--foreground` usage. Expect: Consistent usage across stylesheets. rg --type css --word-regexp '--foreground'Length of output: 457
Script:
#!/bin/bash # Corrected command to verify the usage of the `--foreground` variable in CSS files. # Test: Search for `--foreground` usage. Expect: Consistent usage across stylesheets. rg --type css '--foreground'Length of output: 443
Script:
#!/bin/bash # Corrected command to verify the usage of the `--foreground` variable in CSS files. # Test: Search for `--foreground` usage. Expect: Consistent usage across stylesheets. rg --type css '\-\-foreground'Length of output: 2570
packages/@core/base/design/src/design-tokens/dark/index.css (2)
91-93
: Ensure consistent application of--header
across themes.The
--header
property is introduced for better header customization. Verify that it is consistently applied across all relevant themes and that it meets the design specifications.
Line range hint
120-432
:
Verify the new--header
property in all themes.The
--header
property has been added to multiple themes. Ensure that the color values are appropriate for each theme and provide the desired visual effect.Verification successful
Verification of
--header
Property Across ThemesThe
--header
property is used consistently across various themes with values that appear appropriate for each theme's design. The color values are distinct and tailored to match the intended visual effect of each theme.
- File:
packages/@core/base/design/src/design-tokens/dark/index.css
- Themes and Values:
deep-blue
:222.2 84% 4.9%
green
:20 14.3% 4.1%
neutral
:0 0% 3.9%
zinc
:240 4.9% 83.9%
default
:0 0% 100%
These values ensure that the
--header
property aligns with the visual requirements of each theme.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and values of the `--header` variable across themes. # Test: Search for `--header` usage in dark themes. Expect: Consistent and appropriate values. rg --type css --word-regexp '--header'Length of output: 474
Script:
#!/bin/bash # Corrected command to search for `--header` in CSS files. rg --type css '--header'Length of output: 460
Script:
#!/bin/bash # Corrected command to search for `--header` in CSS files without using the `--` prefix. rg --type css '\-\-header'Length of output: 1340
packages/@core/ui-kit/layout-ui/src/vben-layout.vue (1)
488-488
: Verify the usage of thetheme
parameter.The
handleOpenMenu
function now accepts atheme
parameter. Ensure that this parameter is used correctly throughout the codebase and that all calls to this function are updated to pass the necessary argument.packages/effects/layouts/src/widgets/preferences/preferences-sheet.vue (1)
77-77
: Verify the integration ofthemeSemiDarkHeader
.The
themeSemiDarkHeader
model is introduced and bound to theTheme
component. Ensure that this model is correctly utilized and that any dependencies or related logic are updated accordingly.Verification successful
Let's adjust the search to not specify a file type, which should allow us to locate the usage of
themeSemiDarkHeader
across the codebase.
Integration of
themeSemiDarkHeader
VerifiedThe
themeSemiDarkHeader
model is correctly integrated and utilized withv-model
bindings in the componentspreferences-sheet.vue
andtheme.vue
. This confirms its proper usage and alignment with the expected data flow in the application.
- Files:
packages/effects/layouts/src/widgets/preferences/preferences-sheet.vue
packages/effects/layouts/src/widgets/preferences/blocks/theme/theme.vue
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration and usage of `themeSemiDarkHeader` within the codebase. # Test: Search for the model usage. Expect: Consistent usage across components. rg --type vue -A 5 $'themeSemiDarkHeader'Length of output: 68
Script:
#!/bin/bash # Description: Verify the integration and usage of `themeSemiDarkHeader` within the codebase. # Test: Search for the model usage. Expect: Consistent usage across components. rg -A 5 'themeSemiDarkHeader'Length of output: 2616
docs/src/guide/in-depth/theme.md (3)
764-764
: Verify the updated--border
value.The
--border
variable has been updated to a new color value. Ensure that this change is consistent with the overall theme design and that it is applied correctly throughout the application.Verification successful
The
--border
variable update is consistent with theme design.The
--border
variable is used across multiple themes with varying values, indicating intentional design choices. The specific update to240 3.7% 22%
aligns with the dark theme's design specifications.
- Location:
packages/@core/base/design/src/design-tokens/dark/index.css
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and consistency of the updated `--border` variable. # Test: Search for the `--border` variable usage. Expect: Consistent values across themes. rg --type css -A 5 $'--border'Length of output: 440
Script:
#!/bin/bash # Description: Correctly verify the usage and consistency of the updated `--border` variable. # Test: Search for the `--border` variable usage. Expect: Consistent values across themes. rg --type css -A 5 '--border'Length of output: 440
Script:
#!/bin/bash # Description: Correctly verify the usage and consistency of the updated `--border` variable. # Test: Search for the `--border` variable usage. Expect: Consistent values across themes. rg --type css -A 5 '\-\-border'Length of output: 14298
334-334
: Verify the updated--foreground
value.The
--foreground
variable has been updated to a new color value. Ensure that this change aligns with the overall theme design and is consistently applied throughout the application.
118-118
: Verify the updated--header
values.The
--header
variable has been updated in both light and dark themes. Ensure that these changes align with the desired design specifications and that they are applied consistently across the application.Also applies to: 792-792
Verification successful
Consistent Usage of
--header
Variable Across ThemesThe
--header
variable is defined with different values in both the light and dark themes, as expected. Ensure these values align with the design specifications:
- Light Theme:
--header: 0 0% 100%;
inpackages/@core/base/design/src/design-tokens/default/index.css
- Dark Theme Variations: Multiple values are defined for different dark theme variants in
packages/@core/base/design/src/design-tokens/dark/index.css
, such as222.34deg 10.43% 12.27%
,224 71.4% 4.1%
,20 14.3% 4.1%
, etc.Please verify that these values are correct and intended for the respective themes. If any discrepancies are found, adjust them to match the design requirements.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and consistency of the updated `--header` variable. # Test: Search for the `--header` variable usage. Expect: Consistent values across themes. rg --type css -A 5 $'--header'Length of output: 465
Script:
#!/bin/bash # Description: Verify the usage and consistency of the updated `--header` variable. # Corrected Test: Search for the `--header` variable usage across CSS files. rg --type css -A 5 '--header'Length of output: 465
Script:
#!/bin/bash # Description: Verify the usage and consistency of the updated `--header` variable. # Corrected Test: Properly escape the `--header` pattern to search across CSS files. rg --type css -A 5 '\-\-header'Length of output: 6876
packages/@core/ui-kit/shadcn-ui/src/components/ui/hover-card/HoverCardContent.vue
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/@core/ui-kit/layout-ui/src/components/layout-header.vue (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/@core/ui-kit/layout-ui/src/components/layout-header.vue
Description
Type of change
Please delete options that are not relevant.
pnpm-lock.yaml
unless you introduce a new test example.Checklist
pnpm run docs:dev
command.pnpm test
.feat:
,fix:
,perf:
,docs:
, orchore:
.Summary by CodeRabbit
New Features
semiDarkHeader
option for greater customization of the light theme.headerTheme
property to allow dynamic theme adjustments for the header.header
CSS variable enhances header color configurations across themes.Bug Fixes
Style
Documentation