-
Notifications
You must be signed in to change notification settings - Fork 30
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
Rework container level spacing for beta containers #12951
Conversation
Size Change: -54 B (-0.01%) Total Size: 945 kB ℹ️ View Unchanged
|
8f79575
to
2089b7f
Compare
2089b7f
to
4c60c24
Compare
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you soo much this is so much more readable than before and also resolves the design issues with the previous implementation 🙌
/** Fronts containers spacing rules vary depending on the size of their container spacing which is derived from if the next container is a primary or secondary. */ | ||
containerSpacing?: 'large' | 'small'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 so much better 👏
/** Depending on the next sibling of the container, we assign either large or small spacing rules during render */ | ||
const getContainerSpacing = (nextSiblingCollection?: FECollectionType) => { | ||
const nextCollectionIsPrimary = | ||
nextSiblingCollection?.config.collectionLevel === 'Primary'; | ||
return nextCollectionIsPrimary ? 'large' : 'small'; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super neat!
Seen on PROD (merged by @abeddow91 9 minutes and 57 seconds ago) Please check your changes! |
What does this change?
Reworks how container spacing is calculated and adds it to the model so that beta containers have either 24px or 40px bottom padding.
This is calculated at the enhancer layer by checking if the next sibling container has
primary
container styling. If this is true, we assign "large" container spacing, else we assign "small" container spacing.There is no extra padding adding after thrashers or ads. These continue to sit flush with the top of the container that follows them.
Previously, container spacing was handled in a mixture of places. This PR reconciles this soft contract so that bottom container spacing is only set in one place: in the front section.
Why?
We want to add additional spacing to the bottom of beta containers that are followed by container with primary styling. It doesn't matter what styling the current container has.
Container spacing rules
small === is not followed by a primary container === 24px bottom padding
large === is followed by a primary container === 40px bottom padding
Screenshots