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/datepicker): popup minHeight is too high and causes blank space #2929

Open
wants to merge 1 commit into
base: feat_v3.x
Choose a base branch
from

Conversation

irisSong
Copy link
Collaborator

@irisSong irisSong commented Jan 8, 2025

截屏2025-01-08 17 12 22

Summary by CodeRabbit

  • 样式更新
    • 为选择器(Picker)组件的弹出层添加了新的 CSS 类
    • 通过新的 .nut-picker-popup 类定义了弹出层的最小高度
    • 增强了选择器弹出层的样式和布局表现

Copy link

coderabbitai bot commented Jan 8, 2025

概述

遍历

这个拉取请求引入了对选择器(Picker)组件的样式和类名进行细微调整。具体而言,在 SCSS 文件中添加了一个新的嵌套类 .nut-picker-popup,并在 React 组件中为 Popup 组件添加了对应的类名。这些更改旨在增强选择器弹出层的样式和定位能力。

变更

文件 变更摘要
src/packages/picker/picker.scss 添加 .nut-picker-popup 类,设置 min-height 属性
src/packages/picker/picker.taro.tsxpicker.tsx Popup 组件添加 className={${classPrefix}-popup}

可能相关的 PR

建议标签

size/S, 3.x

建议审阅者

  • xiaoyatong
  • oasis-cloud

诗歌

🐰 兔子的样式魔法
弹出层高度精心编织
类名悄然添加
代码如诗般轻盈
用户体验微微升级


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 the 3.x label Jan 8, 2025
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.58%. Comparing base (fc8754c) to head (e4651d6).
Report is 2 commits behind head on feat_v3.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v3.x    #2929      +/-   ##
=============================================
- Coverage      85.97%   85.58%   -0.39%     
=============================================
  Files            277      277              
  Lines          18692    18187     -505     
  Branches        2769     2769              
=============================================
- Hits           16070    15565     -505     
  Misses          2617     2617              
  Partials           5        5              

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

@coderabbitai coderabbitai bot added the size/S label Jan 8, 2025
@pull-request-size pull-request-size bot removed the size/S label Jan 8, 2025
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/packages/picker/picker.scss (2)

6-8: 建议重新考虑使用 !important 声明

使用 !important 可能会导致以下问题:

  • 增加样式优先级的复杂性
  • 使未来的样式修改变得困难
  • 可能掩盖更深层次的样式问题

建议通过提高选择器的特异性来解决样式冲突,而不是使用 !important

  &-popup {
-    min-height: calc($popup-title-height + $picker-list-height) !important;
+    min-height: calc($popup-title-height + $picker-list-height);
  }

7-7: 建议添加注释说明高度计算逻辑

为了提高代码的可维护性,建议添加注释说明 min-height 的计算逻辑和组成部分。

  &-popup {
+    // 最小高度 = 弹窗标题高度 + 选择器列表高度
    min-height: calc($popup-title-height + $picker-list-height) !important;
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1539068 and e4651d6.

📒 Files selected for processing (3)
  • src/packages/picker/picker.scss (1 hunks)
  • src/packages/picker/picker.taro.tsx (1 hunks)
  • src/packages/picker/picker.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/packages/picker/picker.taro.tsx
  • src/packages/picker/picker.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test
  • GitHub Check: build
🔇 Additional comments (1)
src/packages/picker/picker.scss (1)

6-8: 验证高度计算是否考虑了所有场景

请确认:

  1. 这个最小高度是否适用于所有使用场景
  2. 是否需要考虑内容padding或margin的影响
  3. 在不同设备尺寸下的表现是否正常
✅ Verification successful

高度计算验证结果

经过验证,当前的最小高度计算是合理的:

  • 标题栏高度(50px) + 列表高度(252px)的计算方式符合组件结构
  • 使用CSS变量实现,支持主题定制和响应式调整
  • 无需考虑内边距影响,因为已包含在预设高度中
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查是否有其他组件依赖这个最小高度设置
rg -l "nut-picker-popup"

# 检查是否存在相关的自适应布局代码
rg "min-height|max-height" src/packages/picker/

Length of output: 182


Script:

#!/bin/bash
# Search for variable definitions
rg "\$popup-title-height|\$picker-list-height" src/

# Look for related styles
ast-grep --pattern 'class $_-popup {
  $$$
}'

# Check for media queries
rg "@media" src/packages/picker/

Length of output: 132


Script:

#!/bin/bash
# Search for variable definitions in config/theme
fd -t f . -e scss | xargs rg "\$popup-title-height|\$picker-list-height"

# Look for popup styles with context
rg -A 5 "popup" src/packages/picker/

# Search for height-related styles
rg "height:" src/packages/picker/

Length of output: 9004


Script:

#!/bin/bash
# Search for variable definitions in theme files
fd -t f . -e scss | xargs rg "^\s*\$(popup-title-height|picker-list-height|picker-item-height)"

# Check if there are any theme configuration files
fd -t f "theme|config|variables" -e scss

Length of output: 487


Script:

#!/bin/bash
# Check variables.scss for picker-related definitions
rg -A 1 "popup-title-height|picker-list-height|picker-item-height" src/styles/variables.scss

# Check theme files for any overrides
rg -A 1 "popup-title-height|picker-list-height|picker-item-height" src/styles/theme-*.scss

# Look for any media queries that might affect these variables
rg "@media.*picker" src/styles/

Length of output: 630

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

Successfully merging this pull request may close these issues.

1 participant