fix(alert): adapt to Alert Components#4120
Conversation
WalkthroughThese changes introduce responsive styling for alerts by replacing the adaptation module with a new responsive module in the theme package. A new responsive.less file is created to handle small-screen alert styling, with corresponding CSS custom properties added to the vars.less file for title font size and text color adjustments. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/theme/src/alert/vars.less (1)
117-119: Variable naming may be misleading for intended usage.The variable
--tv-Alert-title-adapt-text-colorsuggests it's for the title, but inresponsive.less(line 16) it's applied to the description element (.@{alert-prefix-cls}__description). Consider either:
- Renaming to a more generic name like
--tv-Alert-content-adapt-text-coloror--tv-Alert-desc-adapt-text-color, or- Adding a separate variable for description if both title and description need different colors
♻️ Suggested rename if this variable is for description
// 适配小屏定义-adapt- --tv-Alert-title-adapt-font-size: var(--tv-font-size-md, 14px); - --tv-Alert-title-adapt-text-color: var(--tv-color-text, `#191919`); + --tv-Alert-desc-adapt-text-color: var(--tv-color-text, `#191919`);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/theme/src/alert/vars.less` around lines 117 - 119, The variable --tv-Alert-title-adapt-text-color is misnamed because responsive.less applies it to .@{alert-prefix-cls}__description; update the variable naming or add a new one: either rename --tv-Alert-title-adapt-text-color to a generic --tv-Alert-content-adapt-text-color (or --tv-Alert-desc-adapt-text-color) and update usages in responsive.less, or create a new variable --tv-Alert-desc-adapt-text-color and use that in responsive.less while keeping --tv-Alert-title-adapt-text-color for the title; ensure the chosen symbol names match across vars.less and responsive.less (e.g., --tv-Alert-desc-adapt-text-color and .@{alert-prefix-cls}__description).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/theme/src/alert/responsive.less`:
- Around line 15-17: The .@{alert-prefix-cls}__description rule is using the
title-specific variable --tv-Alert-title-adapt-text-color; confirm intent and
either (A) if description should share the title color, rename the variable in
vars.less to a generic name like --tv-Alert-adapt-text-color and update all
usages (including the title rule) to that new name, or (B) if description needs
a distinct color, add a new variable (e.g.,
--tv-Alert-description-adapt-text-color) in vars.less and change
.@{alert-prefix-cls}__description to use that new variable; update any related
references to keep naming consistent.
---
Nitpick comments:
In `@packages/theme/src/alert/vars.less`:
- Around line 117-119: The variable --tv-Alert-title-adapt-text-color is
misnamed because responsive.less applies it to
.@{alert-prefix-cls}__description; update the variable naming or add a new one:
either rename --tv-Alert-title-adapt-text-color to a generic
--tv-Alert-content-adapt-text-color (or --tv-Alert-desc-adapt-text-color) and
update usages in responsive.less, or create a new variable
--tv-Alert-desc-adapt-text-color and use that in responsive.less while keeping
--tv-Alert-title-adapt-text-color for the title; ensure the chosen symbol names
match across vars.less and responsive.less (e.g.,
--tv-Alert-desc-adapt-text-color and .@{alert-prefix-cls}__description).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1fb4e769-6fd8-445f-b1e8-1c79bcde0bc0
📒 Files selected for processing (3)
packages/theme/src/adaptation-index.lesspackages/theme/src/alert/responsive.lesspackages/theme/src/alert/vars.less
| .@{alert-prefix-cls}__description { | ||
| color: var(--tv-Alert-title-adapt-text-color); | ||
| } |
There was a problem hiding this comment.
Description element uses title-named variable - verify this is intentional.
The description element is styled with --tv-Alert-title-adapt-text-color, which is semantically named for the title. If this is intentional (same color for both), consider renaming the variable in vars.less to be more generic (e.g., --tv-Alert-adapt-text-color).
If description should have a different color, a separate variable should be used.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/theme/src/alert/responsive.less` around lines 15 - 17, The
.@{alert-prefix-cls}__description rule is using the title-specific variable
--tv-Alert-title-adapt-text-color; confirm intent and either (A) if description
should share the title color, rename the variable in vars.less to a generic name
like --tv-Alert-adapt-text-color and update all usages (including the title
rule) to that new name, or (B) if description needs a distinct color, add a new
variable (e.g., --tv-Alert-description-adapt-text-color) in vars.less and change
.@{alert-prefix-cls}__description to use that new variable; update any related
references to keep naming consistent.
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
适配小屏幕显示
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit