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

Additional padding and margin settings #1110

Merged
merged 15 commits into from
Jan 12, 2022
Merged

Additional padding and margin settings #1110

merged 15 commits into from
Jan 12, 2022

Conversation

tyleralsbury
Copy link
Contributor

Why are these changes introduced?

Fixes #1039.

What approach did you take?

  • A continuation of the approach to the rest of the section padding, applied to more sections (particularly main sections as well as static sections)
  • Added top margin setting to footer
  • Added bottom margin setting to header

Other considerations

Demo links

Checklist

@ludoboludo ludoboludo self-requested a review January 7, 2022 20:46
@@ -109,6 +109,7 @@

.article-template__comment-wrapper {
margin-top: 5rem;
padding: 2rem 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if here we should have a setting as well or not. Maybe it's overkill... but a value a bit bigger I think would be nicer. Like the default 36px used for section padding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is a bit weird because it's not its own section, so the setting is a bit different in terms of context. I can change the hardcoded value, but we'll need to think of how we want to handle a case like this where it's the not the padding of the full section - or we need to extract the comments part of the blog post into its own section for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah 🤔 At first I was going to say that it could reuse the value from the "section" but since it's a template it doesn't have it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wouldn't be particularly intuitive to use a section setting that works consistently everywhere else in a different way - I think the path forward is probably to turn the comments bit into its own separate section from the article itself and then apply the setting that way. Sort of similar to the way the cart items and cart footer are separate, for example.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think that makes sense 🤔

@@ -982,6 +982,10 @@ summary::-webkit-details-marker {
}
}

.grid:last-child {
margin-bottom: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious to know which ones we had as an offender here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This accounts for any case where .grid is the last element - looking through the code it seems like this is often the case. The only thing that it does cause, which might be an issue, is that if it's the last child of some parent element that has something else after it it might not be great.

I'm going to go through and see if that's the case anywhere. I notice that it does squish the margin between the cards in Featured Collection and the View all button.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out there's a lot of inconsistencies with those types of buttons...

I've added some spacing for the one for Featured Collection cause it was wonky looking, but just looking at the remaining ones:

// Blog view all button

.blog__button {
  margin-top: 3rem;
}

@media screen and (min-width: 750px) {
  .blog__button {
    margin-top: 5rem;
  }
}

// Multicolumn

.multicolumn .button {
  margin-top: 1.5rem;
}

@media screen and (min-width: 750px) {
  .multicolumn .button {
    margin-top: 4rem;
  }
}

And both collection list and featured collection had just 2rem. I think changing them all to 2rem all the time would be good for consistency, and would potentially reduce CSS if we considered them to be a "button at the bottom of a section" component (naming is hard) and just used a class for all of them.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could look into why the grid component (which is used in a variety of scenarios) imposes a 2rem bottom margin in the first place. I'd be in favour of setting .grid to a default zero top and bottom margin and only add margin in cases where it's really needed. That would require testing each scenario, so probably out of scope for this PR.

ludoboludo
ludoboludo previously approved these changes Jan 10, 2022
ludoboludo
ludoboludo previously approved these changes Jan 11, 2022
Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

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

A couple things we could fix, brought up in slack:

  • .newsletter:not(.newsletter--narrow) .newsletter__wrapper.color-background-1 is applying some extra margin we shouldn't need anymore due to the settings we offer.
  • I think that you mention this in another PR/context but it seems like the section title margin is off sometimes. We have .title-wrapper-with-link which applies a top margin but I don't think we need it anymore. And we also have .title-wrapper--no-top-margin to remove that top margin... But im pretty sure you mentioned looking into it in a specific refactor issue for titles.

@tyleralsbury
Copy link
Contributor Author

  • I think that you mention this in another PR/context but it seems like the section title margin is off sometimes. We have .title-wrapper-with-link which applies a top margin but I don't think we need it anymore. And we also have .title-wrapper--no-top-margin to remove that top margin... But im pretty sure you mentioned looking into it in a specific refactor issue for titles.

Yeah, for now I'll just implement it the same was as before and then when I get a chance, I will refactor them all to just be .title and .title--with-link or something because there's no reason to have so many different modifiers at this stage.

Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

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

Alrighty, I think it's the last couple things I will mention 🤔

If we could edit the section title for both Multicolumn and Collapsible content that would make the spacing look good everywhere I believe. It's a matter of just adding the class .title-wrapper--no-top-margin:

ludoboludo
ludoboludo previously approved these changes Jan 12, 2022
@KaichenWang KaichenWang self-requested a review January 12, 2022 15:41
KaichenWang
KaichenWang previously approved these changes Jan 12, 2022
@@ -982,6 +982,10 @@ summary::-webkit-details-marker {
}
}

.grid:last-child {
margin-bottom: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We could look into why the grid component (which is used in a variety of scenarios) imposes a 2rem bottom margin in the first place. I'd be in favour of setting .grid to a default zero top and bottom margin and only add margin in cases where it's really needed. That would require testing each scenario, so probably out of scope for this PR.

@tyleralsbury
Copy link
Contributor Author

We could look into why the grid component (which is used in a variety of scenarios) imposes a 2rem bottom margin in the first place. I'd be in favour of setting .grid to a default zero top and bottom margin and only add margin in cases where it's really needed. That would require testing each scenario, so probably out of scope for this PR.

I looked at all of the scenarios where .grid was the last child and tested them to try and account for things. For now, this seems like a decent solution, but you're right that I think the long-term ideal solution is for the grid itself to not impose margins to begin with and for the context to dictate that.

It's sort of similar to the added complexity of .title and its myriad of modifiers - we've added things to a class that might be better served by handling it in-context.

@tyleralsbury
Copy link
Contributor Author

Reviews got dismissed because of the end of file new line commit @ludoboludo @KaichenWang

@tyleralsbury tyleralsbury merged commit 3a83ec7 into main Jan 12, 2022
@tyleralsbury tyleralsbury deleted the padding-follow-up branch January 12, 2022 17:10
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Additional padding and margin settings

Co-authored-by: translation-platform[bot] <34770790+translation-platform[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Padding settings follow-up
4 participants