Skip to content
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

fix: 修改tag和badge字体样式变量 #2681

Merged
merged 4 commits into from
Oct 31, 2024
Merged

Conversation

irisSong
Copy link
Collaborator

@irisSong irisSong commented Oct 30, 2024

🤔 这个变动的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能
    • 更新了 .nut-tag 组件的背景颜色,增强了视觉效果。
  • 样式
    • .nut-tag-info 背景色从 #1988fa 更改为 #0073ff
    • .nut-tag-warning 背景色从 #c47600 更改为 #ffbf00
    • 更新了标签和徽章的默认字体大小,确保样式的一致性和可维护性。

Copy link

coderabbitai bot commented Oct 30, 2024

Walkthrough

此次更改涉及对.nut-tag组件的CSS样式和variables.scss文件中的样式变量进行了修改。具体而言,.nut-tag-info.nut-tag-warning类的背景颜色被更新,分别从#1988fa更改为#0073ff,以及从#c47600更改为#ffbf00。同时,样式变量的默认值也进行了调整,以确保在不同组件中的样式一致性和可维护性。

Changes

文件路径 更改摘要
src/packages/tag/tag.harmony.css 更新.nut-tag-info背景颜色从#1988fa#0073ff,更新.nut-tag-warning背景颜色从#c47600#ffbf00
src/styles/variables.scss 更新$tag-font-size$badge-font-size变量的默认值,从$font-size-xs改为$font-size-xxs

Possibly related PRs

Suggested labels

size/S

Suggested reviewers

  • irisSong
  • oasis-cloud

Poem

在兔子的小花园里,
标签色彩如花绽放,
蓝天与金黄相映衬,
样式更新,心欢畅。
让我们一起欢庆吧,
兔子舞动,乐无疆! 🐇✨


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?

❤️ Share
🪧 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 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.

@irisSong irisSong changed the title fix: 修改tag和badge字体变量 fix: 修改tag和badge字体样式变量 Oct 30, 2024
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between aba2e6b and eac72af.

📒 Files selected for processing (2)
  • src/packages/tag/tag.harmony.css (2 hunks)
  • src/styles/variables.scss (2 hunks)
🔇 Additional comments (2)
src/packages/tag/tag.harmony.css (1)

31-31: 信息标签颜色更改已确认

新的蓝色 (#0073ff) 提供了更好的视觉对比度,这是一个很好的改进。

src/styles/variables.scss (1)

1548-1548: 字体大小变更合理且保持一致性

将 tag 和 badge 的字体大小从 $font-size-xs (11px) 统一调整为 $font-size-xxs (10px) 的修改是合理的:

  • 更小的字体尺寸使标签和徽章更加紧凑,符合现代 UI 设计趋势
  • 保持了标签和徽章组件之间的视觉一致性

运行以下脚本验证现有使用这些变量的组件:

Also applies to: 1587-1587

✅ Verification successful

字体大小变更验证完成,修改安全可靠

根据代码验证结果:

  • Tag 组件中使用 $tag-font-size 变量定义文字大小,应用于标签文本和图标
  • Badge 组件中使用 $badge-font-size 变量定义徽标文字大小
  • 主题文件中确认 --nutui-font-size-xxs (10px) 作为标签类文字的标准大小

这些变更符合组件的实际使用场景,不会造成样式异常。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查使用了这些字体变量的组件
# 预期:找到所有使用 $tag-font-size 和 $badge-font-size 的文件

echo "检查 tag-font-size 的使用:"
rg "\$tag-font-size"

echo "检查 badge-font-size 的使用:"
rg "\$badge-font-size"

Length of output: 155


Script:

#!/bin/bash
# 使用不同的搜索策略来查找变量使用情况

echo "检查 tag-font-size 的使用:"
rg -i "tag.*font.*size|font.*size.*tag" --type scss

echo "检查 badge-font-size 的使用:"
rg -i "badge.*font.*size|font.*size.*badge" --type scss

echo "检查包含这些变量的 SCSS 文件:"
fd -e scss -x cat {} | grep -E "(\$tag-font-size|\$badge-font-size)"

Length of output: 397


Script:

#!/bin/bash
# 不使用文件类型过滤,直接搜索所有文件

echo "检查 tag-font-size 的使用:"
rg "\$tag-font-size" -A 2 -B 2

echo "检查 badge-font-size 的使用:"
rg "\$badge-font-size" -A 2 -B 2

echo "列出所有 SCSS 文件:"
fd ".scss$"

Length of output: 5785


Script:

#!/bin/bash
# 检查具体组件中的使用情况

echo "检查 Tag 组件样式文件:"
cat src/packages/tag/tag.scss

echo "检查 Badge 组件样式文件:"
cat src/packages/badge/badge.scss

echo "检查主题文件中的变量定义:"
cat src/styles/theme-default.scss | grep -E "font-size|tag-|badge-"

Length of output: 4529

@@ -37,7 +37,7 @@
background: #ff0f23;
}
.nut-tag-warning {
background: #c47600;
background: #ffbf00;
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

警告标签的颜色对比度需要调整

根据代码分析,warning类型标签使用了白色文本(#ffffff)配合#ffbf00背景色。这个组合的对比度为1.96:1,不符合WCAG 2.0的AA级标准(需要4.5:1)。建议采用以下方案之一:

  • 将背景色调整为更深的橙色,如 #E67700(对比度4.54:1)
  • 将文本颜色改为深色,如 #000000(对比度11.33:1)
🔗 Analysis chain

建议验证警告标签的颜色对比度

新的警告标签颜色 (#ffbf00) 可能与白色文本 (#ffffff) 的对比度不足,这可能会影响可读性和可访问性。

建议考虑以下解决方案:

.nut-tag-warning {
-  background: #ffbf00;
+  background: #f90;
}

Let me check if there's any text color definition in the codebase that would be used with this background color.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 验证颜色对比度是否符合WCAG 2.0标准
# 使用 https://webaim.org/resources/contrastchecker/ 的算法

# 检查 #ffbf00 (背景) 与 #ffffff (文本) 的对比度
echo "警告标签颜色对比度检查:"
echo "背景色: #ffbf00"
echo "文本色: #ffffff"
echo "请访问 https://webaim.org/resources/contrastchecker/?fcolor=ffffff&bcolor=ffbf00 验证对比度"

Length of output: 414


Script:

#!/bin/bash
# 查找tag相关的CSS文件中的文本颜色定义
rg -l "color:" src/packages/tag/

Length of output: 223


Script:

#!/bin/bash
# 查找tag.harmony.css中的文本颜色定义
rg "color:" -A 2 -B 2 src/packages/tag/tag.harmony.css

# 查找warning类型标签的相关样式
rg "warning" -A 5 -B 5 src/packages/tag/tag.harmony.css

Length of output: 636

@xiaoyatong xiaoyatong merged commit 9f167ea into jdf2e:V3.0 Oct 31, 2024
3 checks passed
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.95%. Comparing base (7515810) to head (1de5f44).
Report is 1 commits behind head on V3.0.

Additional details and impacted files
@@           Coverage Diff           @@
##             V3.0    #2681   +/-   ##
=======================================
  Coverage   83.95%   83.95%           
=======================================
  Files         221      221           
  Lines       17849    17849           
  Branches     2679     2679           
=======================================
  Hits        14986    14986           
  Misses       2858     2858           
  Partials        5        5           

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants