Skip to content

fix(link): adapt link components#4095

Open
James-9696 wants to merge 3 commits intoopentiny:devfrom
James-9696:fix-link-adapt
Open

fix(link): adapt link components#4095
James-9696 wants to merge 3 commits intoopentiny:devfrom
James-9696:fix-link-adapt

Conversation

@James-9696
Copy link
Collaborator

@James-9696 James-9696 commented Feb 25, 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:
    适配link组件小屏显示

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

Release Notes

  • Style

    • Adjusted link component spacing to improve layout density across the interface.
    • Introduced responsive styling for link components on smaller screens (max-width 1280px) with improved text-wrapping behavior.
  • Chores

    • Updated theme configuration to use new responsive stylesheet for link styling.
    • Added theme variable for button group icon styling to enhance visual consistency.

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

coderabbitai bot commented Feb 25, 2026

Walkthrough

Changes update link component styling through margin adjustments in demo files, introduce a new responsive link stylesheet for 1280px max-width breakpoint, switch the theme import source from adaptation to responsive styling, and add a button-group adapt variable for icon radius.

Changes

Cohort / File(s) Summary
Demo Component Spacing
examples/sites/demos/pc/app/link/custom-icon-composition-api.vue, examples/sites/demos/pc/app/link/custom-icon.vue
Reduced .tiny-link margin-right from 48px to 8px for tighter layout spacing.
Theme Import Source
packages/theme/src/adaptation-index.less
Replaced commented import of ./link/adaptation.less with active import of ./link/responsive.less, switching link styling source.
Button Group Variables
packages/theme/src/button-group/vars.less
Added new CSS variable --tv-ButtonGroup-item-adapt-sup-icon-radius with fallback to var(--tv-border-radius-md, 6px) for adapt icon styling.
Link Responsive Stylesheet
packages/theme/src/link/responsive.less
New file providing responsive link component styling at max-width 1280px breakpoint with inline-flex display, nowrap white-space, and success state modifier with color #398500.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hopping through styles, we adjust and refine,
Margins shrink tight, responsive design,
New sheets unfold at breakpoints divine,
Links dance in flex, looking fine and fine!

🚥 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 title 'fix(link): adapt link components' is directly related to the changeset, which focuses on adapting link components for responsive/small-screen display through styling and layout adjustments.
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

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/link/adaptation.less (1)

17-19: Prefer a theme token instead of hardcoding success color.

Using a CSS variable here keeps adaptation styles consistent with theming/customization.

Proposed refactor
     &&--success {
-      color: `#398500`;
+      color: var(--tv-Link-success-text-color, `#398500`);
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/theme/src/link/adaptation.less` around lines 17 - 19, Replace the
hardcoded hex color in the adaptation selector "&&--success" with the theme
token variable used by the project (e.g. the global CSS custom property for
success color) so adaptation styles follow theming; locate the "&&--success"
rule in adaptation.less and change its color from "#398500" to the project
success token (for example var(--color-success) or the relevant token name used
elsewhere) ensuring the variable exists and falls back if necessary.
🤖 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/link/adaptation.less`:
- Around line 13-15: Update the CSS block that currently sets display:
inline-flex; white-space: nowrap; line-height: 20px in adaptation.less so long
localized link text is safely truncated on small screens: keep display:
inline-flex but add min-width: 0; replace the unconstrained white-space behavior
by adding overflow: hidden; text-overflow: ellipsis; and keep white-space:
nowrap (or remove it if you prefer wrapping) so the link respects its flex
container and shows an ellipsis instead of overflowing; ensure the rule still
includes line-height: 20px.

---

Nitpick comments:
In `@packages/theme/src/link/adaptation.less`:
- Around line 17-19: Replace the hardcoded hex color in the adaptation selector
"&&--success" with the theme token variable used by the project (e.g. the global
CSS custom property for success color) so adaptation styles follow theming;
locate the "&&--success" rule in adaptation.less and change its color from
"#398500" to the project success token (for example var(--color-success) or the
relevant token name used elsewhere) ensuring the variable exists and falls back
if necessary.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 519d2c6 and 6582459.

📒 Files selected for processing (5)
  • examples/sites/demos/pc/app/link/custom-icon-composition-api.vue
  • examples/sites/demos/pc/app/link/custom-icon.vue
  • packages/theme/src/adaptation-index.less
  • packages/theme/src/button-group/vars.less
  • packages/theme/src/link/adaptation.less

Comment on lines +13 to +15
display: inline-flex;
white-space: nowrap;
line-height: 20px;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

nowrap here can break small-screen layout with long link text.

Without truncation constraints, long localized labels can overflow horizontally at the exact breakpoint this file targets.

Proposed fix
 .@{link-prefix-cls} {
   .inject-Link-vars();

   display: inline-flex;
+  max-width: 100%;
+  min-width: 0;
   white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
   line-height: 20px;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
display: inline-flex;
white-space: nowrap;
line-height: 20px;
display: inline-flex;
max-width: 100%;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 20px;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/theme/src/link/adaptation.less` around lines 13 - 15, Update the CSS
block that currently sets display: inline-flex; white-space: nowrap;
line-height: 20px in adaptation.less so long localized link text is safely
truncated on small screens: keep display: inline-flex but add min-width: 0;
replace the unconstrained white-space behavior by adding overflow: hidden;
text-overflow: ellipsis; and keep white-space: nowrap (or remove it if you
prefer wrapping) so the link respects its flex container and shows an ellipsis
instead of overflowing; ensure the rule still includes line-height: 20px.

@James-9696 James-9696 changed the title fix(link): adapt link components WIP:fix(link): adapt link components Feb 26, 2026
@github-actions github-actions bot removed the bug Something isn't working label Feb 26, 2026
@James-9696 James-9696 changed the title WIP:fix(link): adapt link components fix(link): adapt link components Feb 26, 2026
@github-actions github-actions bot added the bug Something isn't working label Feb 26, 2026
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/link/adaptation.less (1)

6-7: Unused variable declarations.

@link-svg-prefix-cls and @svg-cls are declared but never used in this file. If these are intended for future use, consider removing them until needed to keep the file clean.

♻️ Proposed cleanup
 `@link-prefix-cls`: ~'@{css-prefix}link';
-@link-svg-prefix-cls: ~'@{link-prefix-cls}-svg';
-@svg-cls: ~'@{css-prefix}svg';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/theme/src/link/adaptation.less` around lines 6 - 7, Remove the
unused Less variables `@link-svg-prefix-cls` and `@svg-cls` from the adaptation.less
file (or use them if they were intended): locate the declarations of
`@link-svg-prefix-cls` and `@svg-cls` and either delete those two lines or replace
their usage where appropriate (e.g., in selectors or mixins that reference
@{link-prefix-cls}-svg or @{css-prefix}svg) so the file no longer contains dead
variable declarations.
🤖 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/link/adaptation.less`:
- Around line 17-19: Replace the hardcoded success color in the link selector
"&&--success" with the theme variable: change the color value from "#398500" to
use "var(--tv-Link-success-text-color)" so the link component uses the
centralized success text color defined in vars.less.

---

Nitpick comments:
In `@packages/theme/src/link/adaptation.less`:
- Around line 6-7: Remove the unused Less variables `@link-svg-prefix-cls` and
`@svg-cls` from the adaptation.less file (or use them if they were intended):
locate the declarations of `@link-svg-prefix-cls` and `@svg-cls` and either delete
those two lines or replace their usage where appropriate (e.g., in selectors or
mixins that reference @{link-prefix-cls}-svg or @{css-prefix}svg) so the file no
longer contains dead variable declarations.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6582459 and d60a046.

📒 Files selected for processing (1)
  • packages/theme/src/link/adaptation.less

Comment on lines +17 to +19
&&--success {
color: #398500;
}
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for success color variables in the theme
rg -n '#398500|color-success|success-color' packages/theme/src --type less -C2

Repository: opentiny/tiny-vue

Length of output: 43877


🏁 Script executed:

#!/bin/bash
# Explore the theme directory structure to understand color variable organization
find packages/theme/src -name "*.less" -type f | head -20

Repository: opentiny/tiny-vue

Length of output: 834


🏁 Script executed:

#!/bin/bash
# Search for color variable definitions more broadly
rg -n '@.*success.*color|@.*color.*success' packages/theme/src --type less -A1 -B1

Repository: opentiny/tiny-vue

Length of output: 43


🏁 Script executed:

#!/bin/bash
# Check the vars.less or similar files for color definitions
find packages/theme/src -name "*var*" -o -name "*color*" | head -20

Repository: opentiny/tiny-vue

Length of output: 846


🏁 Script executed:

#!/bin/bash
# Look at the adaptation.less file to see how other colors are defined
cat -n packages/theme/src/link/adaptation.less | head -40

Repository: opentiny/tiny-vue

Length of output: 615


Use the link success text color variable instead of the hardcoded color.

Replace #398500 with var(--tv-Link-success-text-color) to maintain consistency with the theme variables already defined in vars.less. The standard success text color variable is already available and used elsewhere in the link component.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/theme/src/link/adaptation.less` around lines 17 - 19, Replace the
hardcoded success color in the link selector "&&--success" with the theme
variable: change the color value from "#398500" to use
"var(--tv-Link-success-text-color)" so the link component uses the centralized
success text color defined in vars.less.

line-height: 20px;

&&--success {
color: #398500;
Copy link
Member

Choose a reason for hiding this comment

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

这个颜色为什么没有用变量呢?就算是适配移动端颜色应该不用变把

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

设计师给的颜色值

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

基础common没有这个颜色

Copy link
Member

Choose a reason for hiding this comment

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

设计师给的颜色值应该是需要在我们的基础变量中的,如果不在需要和设计师交流好,为啥之前的基础变量没有这个颜色

@James-9696 James-9696 changed the title fix(link): adapt link components wip:fix(link): adapt link components Feb 28, 2026
@github-actions github-actions bot removed the bug Something isn't working label Feb 28, 2026
@James-9696 James-9696 changed the title wip:fix(link): adapt link components fix(link): adapt link components Feb 28, 2026
@github-actions github-actions bot added the bug Something isn't working label Feb 28, 2026
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.

🧹 Nitpick comments (1)
packages/theme/src/link/responsive.less (1)

5-7: Unused variable declarations.

@link-svg-prefix-cls and @svg-cls are declared but never referenced within this file. If they're not needed for the responsive link styles, consider removing them to keep the file clean.

♻️ Proposed cleanup
 `@link-prefix-cls`: ~'@{css-prefix}link';
-@link-svg-prefix-cls: ~'@{link-prefix-cls}-svg';
-@svg-cls: ~'@{css-prefix}svg';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/theme/src/link/responsive.less` around lines 5 - 7, The file
declares unused Less variables `@link-svg-prefix-cls` and `@svg-cls` which should be
removed to clean up responsive.less; locate the declarations of
`@link-svg-prefix-cls` and `@svg-cls` near `@link-prefix-cls` and delete them (or, if
they are intended to be used, reference them in the responsive link styles
instead), ensuring only `@link-prefix-cls` remains if SVG prefixes are not needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/theme/src/link/responsive.less`:
- Around line 5-7: The file declares unused Less variables `@link-svg-prefix-cls`
and `@svg-cls` which should be removed to clean up responsive.less; locate the
declarations of `@link-svg-prefix-cls` and `@svg-cls` near `@link-prefix-cls` and
delete them (or, if they are intended to be used, reference them in the
responsive link styles instead), ensuring only `@link-prefix-cls` remains if SVG
prefixes are not needed.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d60a046 and f6274b5.

📒 Files selected for processing (2)
  • packages/theme/src/adaptation-index.less
  • packages/theme/src/link/responsive.less
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/theme/src/adaptation-index.less

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.

2 participants