Skip to content

fix(noticebar): 适配鸿蒙样式修复#3332

Merged
oasis-cloud merged 1 commit intojdf2e:feat_v3.xfrom
xiaoyatong:fix3/line-height
Aug 15, 2025
Merged

fix(noticebar): 适配鸿蒙样式修复#3332
oasis-cloud merged 1 commit intojdf2e:feat_v3.xfrom
xiaoyatong:fix3/line-height

Conversation

@xiaoyatong
Copy link
Collaborator

@xiaoyatong xiaoyatong commented Aug 15, 2025

🤔 这个变动的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • Style
    • 统一公告栏左右图标与内容文字的主题色,使图标与文本颜色与通知条颜色保持一致。
    • 为公告栏内容容器新增垂直居中对齐(align-items: center),提升排版和可读性。
    • 调整内容区颜色继承与应用,确保 .nut-icon 与内容文本使用同一主题色配置。

@coderabbitai
Copy link

coderabbitai bot commented Aug 15, 2025

Walkthrough

更新 NoticeBar 组件样式:为左右图标与内容文本统一应用 $noticebar-color,并在包裹容器中垂直居中对齐。

Changes

Cohort / File(s) Summary of Changes
NoticeBar 样式调整
src/packages/noticebar/noticebar.scss
- .nut-noticebar-left-icon.nut-noticebar-right-icon 中的 .nut-icon 颜色设为 $noticebar-color
- .nut-noticebar-box-wrap 增加 align-items: center
- .nut-noticebar-box-wrap-content 文本颜色设为 $noticebar-color

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • oasis-cloud
  • irisSong
  • Alex-huxiyang

Poem

我在样式草丛里轻轻跃,
左右小图标同色不再错觉。
文案也披上同样的光泽,
垂直居中,风吹不倾斜。
叮咚一跳,样式更纯粹,—一只快乐的兔子🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • 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
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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 action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Aug 15, 2025
@codecov
Copy link

codecov bot commented Aug 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (6f80776) to head (e28593c).
⚠️ Report is 1 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3332   +/-   ##
==========================================
  Coverage      88.13%   88.13%           
==========================================
  Files            291      291           
  Lines          19140    19140           
  Branches        2971     2971           
==========================================
  Hits           16869    16869           
  Misses          2266     2266           
  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.

@oasis-cloud oasis-cloud merged commit 842c48b into jdf2e:feat_v3.x Aug 15, 2025
8 checks passed
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 (6)
src/packages/noticebar/noticebar.scss (6)

54-56: 图标颜色建议改为继承,避免过度绑定主题变量

目前强制将左侧图标颜色设为 $noticebar-color。为增强可定制性(例如组件 props/自定义主题/行内样式覆盖),建议让图标使用继承色,从父容器的 color 统一接管,这样既满足“与文本统一颜色”的目标,又不提高选择器特异性,便于外部覆盖。

可选修改(更弹性):

-      .nut-icon {
-        color: $noticebar-color;
-      }
+      .nut-icon {
+        color: inherit;
+      }

66-70: 同右侧图标:使用继承色更利于主题/样式覆盖

与左侧图标一致,这里建议避免直接写死 $noticebar-color,使用继承能与父级 color 同步,减少未来主题扩展/用户自定义颜色时的阻力。

可选修改:

       .nut-icon {
         width: 12px;
         height: 12px;
-        color: $noticebar-color;
+        color: inherit;
       }

73-77: 垂直居中对 wrap 生效范围有限,请确认预期场景

给 &-wrap 增加 align-items: center 能改善 wrapable/center 模式下(内容非绝对定位)的垂直对齐;但在默认滚动场景中 .nut-noticebar-box-wrap-content 是 position: absolute,flex 对齐不生效。这一改动可能对“跑马灯”模式没有实际居中效果。

请确认在以下模式下是否达到预期:

  • 默认滚动(play / play-infinite)
  • wrapable
  • center

如需在绝对定位场景也精确居中,可能需要:

  • 将内容容器改为相对定位 + inline-flex,或
  • 在绝对定位下使用 top: 50% + translateY(-50%),或
  • 避免绝对定位,改为 flex 容器内滚动。

82-86: 内容文本重复设色,可能增加选择器特异性导致不易覆盖

外层 .nut-noticebar-box 已设置 color: $noticebar-color;此处再给 .nut-noticebar-box-wrap-content 指定颜色属于冗余,且会提升特异性,降低用户通过 props/主题/行内样式覆盖文本颜色的可能性。建议删除或改为继承。

更简化的做法:

-        color: $noticebar-color;

若需保底,亦可显式写:

+        color: inherit;

120-128: 纵向样式的左右图标未同步颜色策略,建议与横向一致

纵向变体 .nut-noticebar-vertical 下的 .nut-noticebar-box-left-icon / -right-icon 未对子级 .nut-icon 设色。为保持“图标与内容文本统一颜色”的目标,建议同横向一致,使用 color: inherit(或若坚持主题变量,也可用 $noticebar-color)。

示例修改(建议使用继承,便于外部覆盖):

 .nut-noticebar-vertical {
   ...
   .nut-noticebar-box-left-icon {
     ...
     display: flex;
     align-self: center;
+    .nut-icon {
+      color: inherit;
+    }
   }
   ...
   .nut-noticebar-box-right-icon {
     align-self: center;
     display: flex;
     justify-content: center;
     width: $noticebar-right-icon-width;
     margin-left: $noticebar-icon-gap;
+    .nut-icon {
+      color: inherit;
+    }
   }
 }

Also applies to: 152-158


1-14: 整体变更方向合理,符合“图标与文本颜色统一、垂直对齐优化”的目标

本次改动围绕颜色一致性与对齐性进行的小幅修正,风险较低,方向合理。上面给出的建议主要为了提升可定制性与覆盖性,不是必须项。

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6f80776 and e28593c.

📒 Files selected for processing (1)
  • src/packages/noticebar/noticebar.scss (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test
  • GitHub Check: build

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/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants