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

[Header] add setting to tweak top and bottom padding #1654

Merged
merged 5 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -2207,20 +2207,9 @@ input[type='checkbox'] {
grid-template-areas: 'left-icon heading icons';
grid-template-columns: 1fr 2fr 1fr;
align-items: center;
padding-top: 1rem;
padding-bottom: 1rem;
}

@media screen and (min-width: 990px) {
.header {
padding-top: 2rem;
padding-bottom: 2rem;
}

.header--has-menu:not(.header--middle-left) {
padding-bottom: 0;
}

.header--top-left,
.header--middle-left:not(.header--has-menu) {
grid-template-areas:
Expand Down
36 changes: 36 additions & 0 deletions sections/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
</style>

{%- style -%}
.header {
padding-top: {{ section.settings.padding_top | times: 0.5 | round: 0 }}px;
padding-bottom: {{ section.settings.padding_bottom | times: 0.5 | round: 0 }}px;
}
Comment on lines +74 to +77
Copy link
Contributor

@ludoboludo ludoboludo May 5, 2022

Choose a reason for hiding this comment

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

We're using times: 0.75 in other sections it seems. I feel like despite the reason you mention it might be better to keep the same approach ? 🤔
Unless we want to stick to those original values I guess. But it would just be off by a few pixels so I think it should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would personally keep it as 0.5 here. A sticky header that is taller has a bigger impact than a section with extra padding at the top, so I think it makes sense to go with a smaller value here. As long as we keep using the same multiples (4px), I personally think it's better to have a header that is not too tall than be consistent.

But I'll keep this conversation unresolved so UX can share their thoughts and make a decision.


.section-header {
margin-bottom: {{ section.settings.margin_bottom | times: 0.75 | round: 0 }}px;
}
Expand All @@ -80,6 +85,13 @@
margin-bottom: {{ section.settings.margin_bottom }}px;
}
}

@media screen and (min-width: 990px) {
Copy link
Contributor

Choose a reason for hiding this comment

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

And here we've used 750px as the threshold instead of 990px. So maybe that could match as well ? So we don't get too much of a different behaviour from one section to another.
But I guess because it switches to hamburger menu maybe it should be that way 🤔

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 should be 990px, it's where the change of layout from hamburger to inline happens :D

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel like there is a specific win from doing it on 990px and over instead of 750px though. And this goes both ways. So I feel like keeping it similar in behaviour to what other sections are doing might be a (small) plus. 🤔
I'd be curious to see what another reviewer thinks of 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.

I'll unresolve the conversation so we can get more thoughts :D

I prefer to keep mobile + tablet with consistent spacing as they look the same (hamburger), instead of aiming to be consistent with other sections that look and behave differently from the header.

.header {
padding-top: {{ section.settings.padding_top }}px;
padding-bottom: {{ section.settings.padding_bottom }}px;
}
}
{%- endstyle -%}

<script src="{{ 'details-disclosure.js' | asset_url }}" defer="defer"></script>
Expand Down Expand Up @@ -826,6 +838,30 @@
"unit": "px",
"label": "t:sections.header.settings.margin_bottom.label",
"default": 0
},
{
"type": "header",
"content": "t:sections.all.padding.section_padding_heading"
},
{
"type": "range",
"id": "padding_top",
"min": 4,
"max": 36,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_top",
"default": 20
},
{
"type": "range",
"id": "padding_bottom",
"min": 4,
"max": 36,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_bottom",
"default": 20
}
]
}
Expand Down