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: 🐛 修复Picker和SelectPicker清空按钮颜色与Input不统一的问题 #700

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

Moonofweisheng
Copy link
Owner

@Moonofweisheng Moonofweisheng commented Nov 8, 2024

🤔 这个 PR 的性质是?(至少选择一个)

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

🔗 相关 Issue

#579 #469

💡 需求背景和解决方案

Picker和SelectPicker的清空按钮颜色同输入框的清空按钮,同时改为不受error状态影响。

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

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

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充

Summary by CodeRabbit

  • 新功能

    • 引入了新的颜色变量 $-cell-clear-color,用于清除按钮的样式。
    • 更新了 wd-pickerwd-select-picker 组件的样式,以支持深色主题和错误状态的视觉反馈。
  • 样式

    • 修改了 wd-pickerwd-select-picker 组件的样式规则,增强了在不同状态下的颜色管理。
    • 为清除按钮添加了新的样式规则,以改善视觉反馈。
  • 文档

    • 更新了组件模板结构,优化了清除图标的渲染方式。

Copy link

vercel bot commented Nov 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wot-design-uni ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2024 5:41am

Copy link

coderabbitai bot commented Nov 8, 2024

Walkthrough

此次更改主要涉及在多个组件的样式和模板结构中引入新的颜色变量 $-cell-clear-color,并对 wd-pickerwd-select-picker 组件的清除图标的渲染方式进行了调整。具体而言,在 SCSS 文件中添加了新的样式规则,以支持深色主题和错误状态的视觉反馈,同时更新了清除图标的 DOM 结构,确保其功能保持一致。

Changes

文件路径 更改摘要
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss 添加变量 $-cell-clear-color: var(--wot-cell-clear-color, #585858) !default;
src/uni_modules/wot-design-uni/components/wd-picker/index.scss 更新 .wot-theme-dark 类,修改错误状态的颜色应用,仅对 .wd-picker__arrow 应用错误颜色,新增样式规则 @include edeep(clear)
src/uni_modules/wot-design-uni/components/wd-picker/wd-picker.vue 将清除图标的渲染从 wd-icon 组件直接更改为包裹在 view 元素中,保持功能不变。
src/uni_modules/wot-design-uni/components/wd-select-picker/index.scss 引入 .wot-theme-dark 类,更新错误状态的颜色应用,新增 edeep(clear) 混合,确保清除按钮颜色定义。
src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue 将清除图标的渲染结构修改为使用 view 元素包裹 wd-icon,移除不必要的 v-else 条件。

Possibly related PRs

🐇 在草地上跳跃,欢声笑语,
新的颜色变量,带来新气息;
清除按钮闪亮,错误无踪影,
组件更美丽,样式更精致!
让我们一起庆祝,代码的奇迹! 🌟


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.

Copy link

netlify bot commented Nov 8, 2024

Deploy Preview for wot-design-uni ready!

Name Link
🔨 Latest commit da4d1a1
🔍 Latest deploy log https://app.netlify.com/sites/wot-design-uni/deploys/672da49ac51eae0008e07d1e
😎 Deploy Preview https://deploy-preview-700--wot-design-uni.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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

🧹 Outside diff range and nitpick comments (1)
src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue (1)

29-31: 清除按钮的事件处理和样式结构优化

通过将清除图标包装在 view 元素中,实现了更好的事件处理和样式控制。这种结构变更与 Input 组件保持一致,有助于统一组件库的交互体验。

建议考虑以下几点来进一步提升组件的可维护性:

  1. 将清除按钮抽象为独立的子组件,以便在 Input、Picker 和 SelectPicker 等组件间复用
  2. 在组件文档中补充清除按钮的样式定制说明
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5e55da4 and da4d1a1.

📒 Files selected for processing (5)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-picker/index.scss (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-picker/wd-picker.vue (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-select-picker/index.scss (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue (1 hunks)
🔇 Additional comments (6)
src/uni_modules/wot-design-uni/components/wd-select-picker/index.scss (2)

75-78: 错误状态样式优化

将箭头图标的错误状态样式与清除按钮分离,这样可以保持错误状态的视觉反馈,同时不影响清除按钮的颜色一致性。这是一个很好的改进。


141-143: 清除按钮样式统一

使用 $-cell-clear-color 变量统一清除按钮的颜色,这符合组件设计规范,确保了与 Input 组件的视觉一致性。实现方式简洁且符合现有代码结构。

src/uni_modules/wot-design-uni/components/wd-picker/index.scss (2)

89-91: 优化错误状态下的样式处理

将错误状态的颜色仅应用于箭头图标,而不影响清除按钮,这样可以保持清除按钮样式的一致性。这个改动符合设计规范,使组件在错误状态下的视觉反馈更加准确。


182-184: 统一清除按钮的颜色样式

通过使用 $-cell-clear-color 变量来设置清除按钮的颜色,确保了与 Input 组件的清除按钮颜色保持一致。这个改动提升了组件库的视觉一致性。

src/uni_modules/wot-design-uni/components/wd-picker/wd-picker.vue (1)

25-27: 清除按钮结构优化,提升组件一致性

将清除图标包装在 view 元素中的修改是合理的,这样可以:

  1. 确保与 Input 组件的结构保持一致
  2. 便于统一管理清除按钮的样式
  3. 保持了原有的事件处理逻辑
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (1)

212-212: 清除按钮颜色变量定义正确!

变量命名规范,颜色值选择合理,并且使用了CSS自定义属性实现主题定制。

运行以下脚本验证变量的使用情况:

✅ Verification successful

清除按钮颜色变量使用正确!

变量 $-cell-clear-color 已在 wd-select-pickerwd-picker 组件中正确使用,实现了清除按钮颜色的统一。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:验证 $-cell-clear-color 变量在组件中的使用情况
# 预期:在 Picker 和 SelectPicker 组件的样式文件中都有使用该变量

# 搜索所有使用该变量的文件
rg '\$-cell-clear-color' 'src/uni_modules/wot-design-uni/components'

Length of output: 413

@Moonofweisheng Moonofweisheng merged commit 8fdbfa3 into master Nov 8, 2024
7 checks passed
@Moonofweisheng Moonofweisheng deleted the fix/picker-clearable-alipay branch November 8, 2024 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant