Skip to content

Comments

fix(badge): 解决中文偏上问题#3111

Merged
oasis-cloud merged 3 commits intojdf2e:feat_v3.xfrom
irisSong:feat_v3.x
Mar 21, 2025
Merged

fix(badge): 解决中文偏上问题#3111
oasis-cloud merged 3 commits intojdf2e:feat_v3.xfrom
irisSong:feat_v3.x

Conversation

@irisSong
Copy link
Collaborator

@irisSong irisSong commented Mar 21, 2025

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fork仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • 样式
    • 优化徽章组件的垂直对齐和盒模型设置,改善整体布局效果。
    • 修改徽章内辅助内容的对齐方式,实现文字居中显示。
    • 移除冗余样式,简化结构。
    • 新增更小的徽章字体大小变量,确保徽章显示一致性。

@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2025

Walkthrough

本次修改调整了徽标组件的样式和相关的变量定义。在 badge.scss 中,为徽标相关类添加和修改了一些 CSS 属性,调整了垂直对齐、盒模型和内容居中方式;同时在 variables.scss 中,将徽标字体大小的默认值从依赖变量改为固定值 9px。此外,在 theme-dark.scsstheme-default.scss 中新增了 CSS 变量 --nutui-font-size-xxxs

Changes

文件路径 变更说明
src/packages/badge/badge.scss .nut-badge 添加 vertical-align: middle;box-sizing: content-box;;在 .nut-badge-sup 中用 text-align: center; 替换 justify-content: center;;移除 .nut-badge-number 中注释的 line-height 代码。
src/styles/variables.scss 新增变量 $font-size-xxxs: var(--nutui-font-size-xxxs, 9px);将 $badge-font-sizevar(--nutui-badge-font-size, $font-size-xxs) 修改为 var(--nutui-badge-font-size, $font-size-xxxs)
src/styles/theme-dark.scss 新增变量 --nutui-font-size-xxxs: var(--nutui-font-size-9)
src/styles/theme-default.scss 新增变量 --nutui-font-size-xxxs: var(--nutui-font-size-9)
src/styles/variables-jmapp.scss 新增变量 $font-size-xxxs: var(--nutui-font-size-xxxs, 9px)
src/styles/variables-jrkf.scss 新增变量 $font-size-xxxs: var(--nutui-font-size-xxxs, 9px)

Possibly related PRs

Suggested reviewers

  • xiaoyatong

Poem

我是一只跳跃的兔,
在代码丛林中轻轻跃动;
样式和变量都有新容,
每一行都闪耀着灵动光芒;
小兔祝福你,更新顺畅! 🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added 3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) labels Mar 21, 2025
@codecov
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.95%. Comparing base (9ada0f8) to head (65ea605).
Report is 6 commits behind head on feat_v3.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v3.x    #3111      +/-   ##
=============================================
+ Coverage      86.49%   86.95%   +0.46%     
=============================================
  Files            280      280              
  Lines          18492    18456      -36     
  Branches        2775     2786      +11     
=============================================
+ Hits           15994    16049      +55     
+ Misses          2493     2402      -91     
  Partials           5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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: 0

🧹 Nitpick comments (2)
src/styles/theme-dark.scss (1)

218-220: 新增徽标文字字体变量

在这一处新增了 CSS 变量 --nutui-font-size-xxxs,并将其默认值设置为 var(--nutui-font-size-9)。此改动有助于调整徽标中文字(特别是中文)的垂直对齐问题,从而修正中文偏上的现象。建议确认这一数值符合整体设计要求,并在各个主题间保持一致性。

src/styles/theme-default.scss (1)

217-219: 新增徽标文字字体变量

与深色主题一致,此处新增了 --nutui-font-size-xxxs 变量,用于设置徽标文字的字体大小,并将其默认值定义为 var(--nutui-font-size-9)。请确认该值在默认主题中也能有效解决中文显示偏上的问题,同时与整个设计系统保持协调。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7e7d86 and 532e0e1.

📒 Files selected for processing (3)
  • src/styles/theme-dark.scss (1 hunks)
  • src/styles/theme-default.scss (1 hunks)
  • src/styles/variables.scss (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test
  • GitHub Check: build
🔇 Additional comments (2)
src/styles/variables.scss (2)

150-150: 新增字体变量定义

这里新增了 $font-size-xxxs 并赋值为 var(--nutui-font-size-xxxs, 9px)。该变量为徽标组件提供了更合适的默认字体尺寸,从而有望解决中文偏上显示的问题。


1620-1620: 更新徽标字体大小引用

$badge-font-size 的默认值从原来的 $font-size-xxs 更新为 $font-size-xxxs,确保徽标组件使用新版字体大小设置。请确认这一改变不会对其他依赖 $badge-font-size 的组件产生负面影响。

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: 0

🧹 Nitpick comments (1)
src/styles/variables-jmapp.scss (1)

177-177: 新增变量 $font-size-xxxs 定义合理
该变量用于提供极小号字体大小,默认值为 9px,并且通过 CSS 自定义属性 --nutui-font-size-xxxs 可在必要时覆盖。建议在项目文档或注释中补充该变量的使用场景,以方便其他开发者了解其用途。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 532e0e1 and 65ea605.

📒 Files selected for processing (2)
  • src/styles/variables-jmapp.scss (1 hunks)
  • src/styles/variables-jrkf.scss (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test
🔇 Additional comments (1)
src/styles/variables-jrkf.scss (1)

193-193: 新增变量 $font-size-xxxs 定义合理
在这一行中,您新增了 $font-size-xxxs: var(--nutui-font-size-xxxs, 9px) !default;。该定义符合项目中其他变量的命名及书写规范,并通过 !default 提供了默认值,便于用户根据需要覆盖设置。请确保在徽标组件或其它相关组件中合理使用此变量,以进一步改善中文文本的垂直对齐问题。

@oasis-cloud oasis-cloud merged commit 464f0a9 into jdf2e:feat_v3.x Mar 21, 2025
8 checks passed
@irisSong irisSong deleted the feat_v3.x branch March 24, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants