feat(design): support fullHeight for Empty and Result - #1587
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

📦 Modified package
🤔 This is a ...
🔗 Related issue link
N/A
💡 Background and solution
Empty / Result are commonly placed in a fixed-height container (Card body, PageContainer content). Today they do not fill that container, so consumers hand-write layout code on the parent to center them, for example:
This PR adds a
fullHeightprop to both components, so the empty state fills the parent height and centers its content by itself:Implementation notes:
fullHeightis applied as a modifier class on the component root, so no extra wrapper element is introduced andclassName/stylefrom consumers keep working as before.min-height: 100%rather thanheight: 100%, so a container that is shorter than the content grows instead of clipping it.display: grid+align-content: center, and the built-in vertical margin of antd Empty is reset.layout="horizontal"is excluded because it already centers content with flex.with-page-containerdemos of both components now usefullHeightinstead of hand-written flex centering.Usage note:
min-height: 100%is resolved against the parent, so the parent needs a definite height (e.g.height: 320orcalc(100vh - 96px)); an intermediate parent withheight: autowill not work.📝 Changelog
- 🆕 Added
fullHeightto fill the parent container height and center the content.- Result
- 🆕 Added
fullHeightto fill the parent container height and center the content.- 🆕 新增
fullHeight属性,用于撑满父容器高度,并将内容整体居中。- Result
- 🆕 新增
fullHeight属性,用于撑满父容器高度,并将内容整体居中。☑️ Self-Check before Merge