Skip to content

fix(alert): adapt to Alert Components#4120

Open
James-9696 wants to merge 1 commit intoopentiny:devfrom
James-9696:fix-alert-adapt
Open

fix(alert): adapt to Alert Components#4120
James-9696 wants to merge 1 commit intoopentiny:devfrom
James-9696:fix-alert-adapt

Conversation

@James-9696
Copy link
Collaborator

@James-9696 James-9696 commented Mar 9, 2026

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:
    适配小屏幕显示

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Style
    • Implemented responsive design improvements for alert components to provide better visual presentation on smaller devices.
    • Added responsive styling that optimizes alert title typography and text color for screens with maximum width up to 1280px.
    • Introduced new customizable theme variables enabling control over alert appearance for small-screen adaptation.

@github-actions github-actions bot added the bug Something isn't working label Mar 9, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Walkthrough

These 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

Cohort / File(s) Summary
Alert Responsive Styling
packages/theme/src/adaptation-index.less, packages/theme/src/alert/responsive.less, packages/theme/src/alert/vars.less
Replaces alert/adaptation.less import with alert/responsive.less. New responsive.less file applies media query styling for screens up to 1280px, adjusting alert title font size and description text color. Adds two CSS custom properties (--tv-Alert-title-adapt-font-size, --tv-Alert-title-adapt-text-color) to vars.less for theme customization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Alerts now dance on smaller screens,
With responsive grace between the seams,
Font sizes shift, colors adjust with care,
Adaptive beauty floating in the air!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(alert): adapt to Alert Components' accurately reflects the main objective of adapting Alert components for small-screen display, as evidenced by the responsive styling additions and variables introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

🧹 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-color suggests it's for the title, but in responsive.less (line 16) it's applied to the description element (.@{alert-prefix-cls}__description). Consider either:

  1. Renaming to a more generic name like --tv-Alert-content-adapt-text-color or --tv-Alert-desc-adapt-text-color, or
  2. 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

📥 Commits

Reviewing files that changed from the base of the PR and between bcdd977 and 96d2451.

📒 Files selected for processing (3)
  • packages/theme/src/adaptation-index.less
  • packages/theme/src/alert/responsive.less
  • packages/theme/src/alert/vars.less

Comment on lines +15 to +17
.@{alert-prefix-cls}__description {
color: var(--tv-Alert-title-adapt-text-color);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant