-
Notifications
You must be signed in to change notification settings - Fork 163
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
Add sections and blocks components #4730
Conversation
Demo starting at https://vanilla-framework-4730.demos.haus |
657abb0
to
12215b1
Compare
@yurii-vasyliev Could you separate removing your previous utils to separate branch? This one will need design review, so may need more time to be merged, and I don't want to block release on having the utils in main branch. I'd like to be able to release whatever else we have. |
How are we handling the case where people start aplying this to headings and override the baseline grid alignment? |
We are not, they are not supposed to do that. It's a container element, not text element. If people start to put class names on wrong elements we can't support whatever comes out of it. The best we can do is properly document and provide examples. By principle you are NEVER supposed to put multiple component class names on single element. So if section/block is a component you don't put this on a heading. But on a wrapper element around the content. |
@bartaz We have a separate issue where @anthonydillon said the spacing should be on the text - can't remember which one it was. People will definitely do it, as much as we don't want them to. We need to make sure it works as expected IMO. We all know how overused the u-sv utilities are. |
Components are not supposed to work on any kind of element. And that's exactly why I think spacing should work on a component level. This way we can avoid issues that If we provide components that have clearly defined scope, document how to use them (and how NOT to use them) I think we can assume developers will be using them correctly and avoid adding loads of exceptions to Vanilla that give an impression that you can use this component like an utility on anything you want (while in reality you can't). If we add exceptions for all heading levels, paragraphs, then what is next? Should it work when you use it with any other component? Lists, chips, grid, navigation? There is a reason why components are independent and are not supposed to be mixed with each other on single element. We talked about it and it seems we have exact and clear rules about when to use each kind of spacing:
These rules can be neatly implemented into components with clear scope and use: you have a top level section on the page? use section (deep if it's highlighted), you have multiple blocks within the section: use block container for them. Allowing to put spacing on any element on the page makes these rules fuzzy and harder to apply. I'm trying to make the Vanilla components implement the design rules. And as far as I understand in design terms we talk about sections and siblings, not about adding spacing to arbitrary headings and paragraphs on the page. And if I'm wrong, than I guess we need to get back to drawing board with that… |
@bartaz sorry I think I got confused - I think I saw u-sv--shallow, u-sv--deep, etc - that's what I was talking about. Looking at the code now it is p-section, and I fully agree with you about those cases - noone will put that on text. Did the pr change? Or did I see u-sv-sdeep in some other part and leave the comment in the wrong place |
You are right, it used to be implemented as |
From talking with Lyubo it seems that the "deep" sections will always need a top and bottom padding, so should be implemented using existing strips. The new section component will only be used instead of strip (or inside the strip) when section follow each other without background change or emphasis. So the |
margin-bottom: calc($spacing / 2) !important; | ||
|
||
@media (min-width: $breakpoint-large) { | ||
margin-bottom: calc($spacing) !important; | ||
} |
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.
What is the !important
for?
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.
I think it was a leftover from utilities that were used before, should be removed.
overflow:auto fixes the above ^ @bartaz Separately, if I wanted to make this section dark or light grey, how would I do it? Asking as the spac eat the bottom is done with a margin, so that part would not be tinted by any background applied to the p-section or any of its children. |
|
@ClementChaumel ah sorry I forgot. Still think padding-bottom would be more predictable and intuitive given strips use padding-bottom |
removed responsive shrinking of shallow strips/sections
@ClementChaumel I've often thought of doign this but refrained as it might backfire. Let's try it and see what happens. We can always drop it if it causes issues. Now's the time to experiment with things like this. |
@ClementChaumel @lyubomir-popov the issue unfortunately is also with how to implement it. We can't just We also not always know if something is last child - there may be additional wrappers around things, like columns. |
let's not do it then. we don't want to make it more complicated. |
What do you mean, what happens if we just set it to 0? |
@ClementChaumel for example, a p's margin-bottom is 1.5rem - $nudge (.4rem). That's what keeps it on the baseline grid, and the nudge value differs at every font-size. So if you replace 1.1rem with 0, you go off the baseline grid. |
Ah ok I see what you mean! I personally find it less noticeable than the consistent spacing but that's fine if that's what we want to prioritise. |
Done
Added three new classes:
.p-block
,.p-section
for managing spacing between different types of elements on the page.Fixes WD-3019
QA
Check if PR is ready for release
If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:
Feature 🎁
,Breaking Change 💣
,Bug 🐛
,Documentation 📝
,Maintenance 🔨
.package.json
should be updated relative to the most recent release, following semver convention: