Skip to content

feat: ✨ grid-item添加hover-class - #994

Merged
Moonofweisheng merged 3 commits into
Moonofweisheng:masterfrom
RJQingHuan:feat-grid-hover
Apr 3, 2025
Merged

feat: ✨ grid-item添加hover-class#994
Moonofweisheng merged 3 commits into
Moonofweisheng:masterfrom
RJQingHuan:feat-grid-hover

Conversation

@RJQingHuan

@RJQingHuan RJQingHuan commented Apr 3, 2025

Copy link
Copy Markdown
Collaborator

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

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

🔗 相关 Issue

close #985
close #883

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能

    • 网格组件现支持点击交互,并引入自定义悬停效果,提升用户交互体验。
    • 新增hover-class属性,允许用户自定义网格项的悬停样式。
  • 文档

    • 优化了网格组件文档中的属性说明和表格布局,描述更清晰易懂。
  • 样式

    • 新增适用于标准和深色主题的悬停背景效果,确保视觉反馈的一致性。

@vercel

vercel Bot commented Apr 3, 2025

Copy link
Copy Markdown

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 Apr 3, 2025 5:19am

@coderabbitai

coderabbitai Bot commented Apr 3, 2025

Copy link
Copy Markdown

Walkthrough

此次变更主要为 grid 组件引入点击反馈和按下样式。文档更新了 <wd-grid> 的属性表,添加了 clickablehover-class 属性,并调整了表格格式。样式部分新增了 SCSS 变量以支持标准和暗黑主题下的 hover 背景色。组件内部新增了 hoverClass 计算属性,用于根据父组件的 clickable 状态及自定义设置决定 hover 效果。同时,类型定义也进行了相应更新以支持新的属性。

Changes

文件路径 变更摘要
docs/component/…/grid.md 调整 <wd-grid> 属性表格式,新增 hover-class 属性描述
src/pages/grid/Index.vue <wd-grid> 组件添加 clickable 属性,启用点击交互
src/uni_modules/wot-design-uni/components/common/…/variable.scss
src/uni_modules/wot-design-uni/components/wd-grid-item/index.scss
新增 SCSS 变量 $-grid-item-hover-bg$-grid-item-hover-bg-dark;在网格项中添加 hover 状态的背景色设置
src/uni_modules/wot-design-uni/components/wd-grid-item/wd-grid-item.vue
src/uni_modules/wot-design-uni/components/wd-grid/types.ts
wd-grid-item 中新增 hoverClass 计算属性;类型定义中增加 hoverClass 属性支持

Sequence Diagram(s)

sequenceDiagram
    participant User as 用户
    participant Grid as <wd-grid>
    participant Item as <wd-grid-item>

    User->>Item: 悬停/点击网格项
    Item->>Grid: 获取 clickable 及 hover-class 配置
    Item-->>User: 显示或取消 hover 样式反馈
Loading

Assessment against linked issues

Objective Addressed Explanation
[#985] gird item 如果可以点击,最好有点击效果
[#883] grid-item 带有按下样式(默认启用,可配置关闭) 通过 hover-classhoverClass 属性实现

Suggested reviewers

  • Moonofweisheng

Poem

我是一只小兔子,
跳跃在代码的花园里;
格子点击闪烁如星,
按下样式柔美无比;
每一行变更都欢喜,
代码如诗意盎然🐰!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 46c5633 and d61a6f1.

📒 Files selected for processing (1)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - wot-design-uni
  • GitHub Check: Header rules - wot-design-uni
  • GitHub Check: Pages changed - wot-design-uni

🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

@petercat-assistant

Copy link
Copy Markdown

Walkthrough

此PR为grid-item组件添加了hover-class属性,允许用户自定义按下时的样式类。更新包括文档、样式文件和组件逻辑的修改。

Changes

文件 概要
docs/component/grid.md 更新了Grid组件的属性表,添加了hover-class属性的说明。
src/pages/grid/Index.vue 在示例代码中为wd-grid组件添加了clickable属性。
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss 添加了hover状态的背景色变量。
src/uni_modules/wot-design-uni/components/wd-grid-item/index.scss grid-item组件添加了hover状态的样式。
src/uni_modules/wot-design-uni/components/wd-grid-item/wd-grid-item.vue 修改了模板和逻辑以支持hover-class属性。
src/uni_modules/wot-design-uni/components/wd-grid/types.ts 更新了GridProvide类型定义,添加了hoverClass属性。

@netlify

netlify Bot commented Apr 3, 2025

Copy link
Copy Markdown

Deploy Preview for wot-design-uni ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit d61a6f1
🔍 Latest deploy log https://app.netlify.com/sites/wot-design-uni/deploys/67ee1a14adf13d0008551f66
😎 Deploy Preview https://deploy-preview-994--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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
docs/component/grid.md (1)

224-233: 文档更新:新增 hover-class 属性的说明

文档在 Grid Attributes 表中新增了 hover-class 属性,用于指定 grid-item 按下时应用的样式类,并且默认值设置为 wd-grid-item__content--hover。此处描述清晰明确,但建议开发者检查组件内部关于 hoverClass 计算属性的实现,确保文档描述与实际行为保持一致。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49e5d63 and 46c5633.

📒 Files selected for processing (6)
  • docs/component/grid.md (3 hunks)
  • src/pages/grid/Index.vue (1 hunks)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-grid-item/index.scss (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-grid-item/wd-grid-item.vue (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-grid/types.ts (2 hunks)
🔇 Additional comments (7)
src/pages/grid/Index.vue (1)

7-7: 添加了clickable属性,启用点击反馈效果

在基本用法示例中添加了clickable属性,这样用户可以看到网格项的点击反馈效果。这与PR的目标"grid-item添加hover-class"相符。

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

27-29: 暗黑主题下的悬停效果实现

为暗黑主题中的网格项添加了悬停效果,使用了$-grid-item-hover-bg-dark变量来定义悬停时的背景色。使用!important确保样式优先级。


137-139: 默认主题下的悬停效果实现

为默认主题中的网格项添加了悬停效果,使用了$-grid-item-hover-bg变量来定义悬停时的背景色。使用!important确保样式优先级。

src/uni_modules/wot-design-uni/components/wd-grid-item/wd-grid-item.vue (2)

6-6: 添加hover-class属性绑定

在网格项内容元素上添加了hover-class属性绑定,与计算属性hoverClass关联,实现了点击反馈效果。


161-166: 实现hoverClass计算属性

添加计算属性hoverClass,用于根据父组件的clickable状态及自定义设置决定hover效果。如果不可点击,则返回'none'禁用hover效果,保证了组件行为的一致性。

src/uni_modules/wot-design-uni/components/wd-grid/types.ts (2)

21-21: 在GridProvide接口中添加hoverClass属性

GridProvide接口的props对象中添加了hoverClass可选属性,使网格项能够获取父组件定义的自定义悬停类名。


52-56: 添加hoverClass属性定义和注释

gridProps对象添加了hoverClass属性及其注释文档,描述了该属性用于自定义内容区域的hover-class。同时优化了gutter属性的格式,保持代码风格一致性。

Comment thread src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Moonofweisheng
Moonofweisheng merged commit dfaff53 into Moonofweisheng:master Apr 3, 2025
@RJQingHuan
RJQingHuan deleted the feat-grid-hover branch April 3, 2025 08:32
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.

[新功能需求] gird item 如果可以点击,最好有点击效果 [新功能需求] grid-item 带有按下样式

2 participants