Skip to content

Conversation

kinglinglive
Copy link
Contributor

@kinglinglive kinglinglive commented Sep 12, 2025

close #11556

Summary by CodeRabbit

  • 样式
    • 调整加载占位(Skeleton)外观:将整体留白从外边距改为内边距,保持原有高度与激活效果,优化内容与容器的对齐关系与可视留白。
    • 提升加载状态下的视觉一致性与可读性,无功能或交互变化,无需用户操作或配置更新。

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Sep 12, 2025
Copy link

coderabbitai bot commented Sep 12, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

src/loading.tsx 中将 Skeleton 组件的外层样式由 margin 调整为 padding,保持 active 属性不变,无业务逻辑或控制流改动,仅影响外部与内部空间关系。

Changes

Cohort / File(s) Summary of Changes
Loading 样式调整
src/loading.tsx
将样式从 { margin: '24px 40px', height: '60vh' } 改为 { padding: '24px 40px', height: '60vh' };无导出/对外 API 变更。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • feat: add loading.tsx #11510:同一文件 src/loading.tsx 的 Loading 组件最初引入了使用 margin 的样式;本次 PR 将该 margin 改为 padding,属于直接相关的样式更新。

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed 标题“fix: Loading页面超出问题”明确指出本次变更的核心目标:修复 Loading 页面超出(溢出)问题,这与变更摘要中对 src/loading.tsx 中 Skeleton 从 margin 调整为 padding 以改变外部/内部间距的修改相符。标题简洁、聚焦且能让审阅者快速理解主要目的,因此符合标题要求。
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

我是一只小兔叽,蹦到屏幕前边栖,
外间不再推开去,内里轻轻抱紧你。
margin化作padding衣,Skeleton依旧亮晶晶,
UI微调风轻起,代码一行也欢喜。 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed 标题以 “fix:” 开头,简洁明确地描述了针对 Loading 页面溢出问题的修复意图,与将 Skeleton 组件外边距改为内边距的实际改动目标一致,能够让同事快速理解本次变更的核心目的。
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

⚡️ Deploying PR Preview...

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @kinglinglive, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决加载页面(Loading page)的显示问题。通过调整 Skeleton 组件的样式,确保其内容在容器内正确布局,从而避免了页面元素超出边界的情况,提升了用户界面的视觉一致性。

Highlights

  • 修复加载页面布局: 将 src/loading.tsx 中 Skeleton 组件的样式属性从 margin 修改为 padding,以解决加载页面可能出现的超出问题。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

本次 PR 修复了 Loading 页面的溢出问题,通过将 Skeleton 组件的 margin 样式替换为 padding,这是一个正确的修复。代码改动很小且有效。我唯一的建议是关于代码风格和可维护性。为了与项目中的其他组件保持一致(例如使用 antd-style),建议将内联样式提取出来,以提高代码的可读性和长期可维护性。具体细节请参见我对 src/loading.tsx 文件的评论。


const Loading: React.FC = () => (
<Skeleton style={{ margin: '24px 40px', height: '60vh' }} active />
<Skeleton style={{ padding: '24px 40px', height: '60vh' }} active />

Choose a reason for hiding this comment

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

medium

margin 改为 padding 的修复是正确的,它解决了组件的溢出问题。然而,为了提高代码的可维护性和整个项目风格的一致性,建议避免使用内联样式和“魔法数字”(如 24px, 40px)。

在项目的其他部分,例如 src/pages/user/login/index.tsx,已经使用了 antd-stylecreateStyles 来管理样式。推荐遵循这种模式,将样式提取出来。这不仅使组件更整洁,也便于未来统一管理和主题化样式。

例如,可以这样重构:

import { Skeleton } from 'antd';
import { createStyles } from 'antd-style';

const useStyles = createStyles(() => ({
  skeleton: {
    padding: '24px 40px',
    height: '60vh',
  },
}));

const Loading: React.FC = () => {
  const { styles } = useStyles();
  return <Skeleton className={styles.skeleton} active />;
};

export default Loading;

由于这个改动涉及整个文件,无法作为代码建议直接提供,但强烈建议您在后续进行此项重构。

@dosubot dosubot bot added the 🛑 bug label Sep 12, 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 (3)
src/loading.tsx (3)

4-4: 使用逻辑属性,提升 RTL 与可读性

建议用 paddingBlock/paddingInline 替代缩写 padding,并保持现有高度语义不变。

可选改动如下:

-  <Skeleton style={{ padding: '24px 40px', height: '60vh' }} active />
+  <Skeleton
+    style={{ paddingBlock: 24, paddingInline: 40, height: '60vh' }}
+    active
+  />

4-4: 提取样式常量,便于主题化与复用

内联对象每次渲染都会新建,提取为常量可读性更好,也便于后续接入 antd token。

-import { Skeleton } from 'antd';
+import { Skeleton } from 'antd';
+import type { CSSProperties } from 'react';
 
-const Loading: React.FC = () => (
-  <Skeleton style={{ padding: '24px 40px', height: '60vh' }} active />
-);
+const loadingStyle: CSSProperties = { padding: '24px 40px', height: '60vh' };
+const Loading: React.FC = () => <Skeleton style={loadingStyle} active />;

4-4: 在极小视口下考虑 minHeight 以减少截断风险(可选)

如果后续骨架内容增多,固定 height 可能导致内容被裁切;改为 minHeight 更稳妥。若当前页面布局依赖固定高度,请忽略。

-  <Skeleton style={{ padding: '24px 40px', height: '60vh' }} active />
+  <Skeleton style={{ padding: '24px 40px', minHeight: '60vh' }} active />

请在 <768px 与移动端浏览器(含地址栏折叠/展开)下验证无溢出与无额外滚动条。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b39b93 and 3cd7d63.

📒 Files selected for processing (1)
  • src/loading.tsx (1 hunks)
🔇 Additional comments (1)
src/loading.tsx (1)

4-4: 修复方向正确:由 margin 改为 padding 可避免高度外溢

将外边距换成内边距后,容器的 60vh 总高度不再叠加上下 margin,能有效避免小屏下出现溢出/滚动条。实现简洁、无副作用。

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 10, 2025
@afc163 afc163 merged commit ecc135f into ant-design:master Oct 10, 2025
9 of 10 checks passed
coding-ice pushed a commit to coding-ice/ant-design-pro that referenced this pull request Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛑 bug lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [BUG] 首次进入页面,加载骨架屏会超出页面宽度,出现滚动条闪烁。

2 participants