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

Add padding controls to the announcement bar #1789

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

kjellr
Copy link
Contributor

@kjellr kjellr commented Jun 14, 2022

PR Summary:

Adds padding controls to the announcement bar block.

padding

Why are these changes introduced?

Greater design flexibility.

What approach did you take?

This mirrors the approach taken for padding controls on sections (e.g. Rich Text).

Other considerations

  • Not sure if it makes sense to simplify down to just one single control here, instead of two. I think most merchants will likely want equal padding on the top and bottom.
  • The padding here was originally set using rem values, and it feels a little weird to move that back to pixel values. We could use rem values in the slider, but I don't believe we do that anywhere else.

Testing steps/scenarios

Checklist

@kjellr kjellr added the Category: Enhancement New feature or request label Jun 14, 2022
@kjellr kjellr self-assigned this Jun 14, 2022
@@ -1,12 +1,26 @@
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'announcement' -%}
{%- style -%}
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'm not totally sure about this part — it seems weird to declare this inline here, but that appears to be how it's handled for the other sections examples I've seen? I might be misinterpreting...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah you're right with that approach 👍
Because we're looping through blocks and they each need their own styling, it makes sense to do it here and the way you did.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think there could be an approach maybe using CSS custom properties 🤔
Having a general declaration referencing a custom property which is different/updated per blocks.
But I wonder if it would be beneficial. It could prevent outputting the whole declaration for every block but it's not like merchant use 27 announcement bars.

},
{
"type": "header",
"content": "t:sections.all.padding.section_padding_heading"
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 is "Section Padding" — I'm not sure if we need to declare a new string for "Block Padding" instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I kinda feel like it would either need to be named differently or only apply to the container/section for now.

Otherwise it's introducing a pattern that doesn't quite match the rest.

We could have a look at offering that same option of padding on blocks but across the theme 🤔

Copy link
Contributor Author

@kjellr kjellr Jun 30, 2022

Choose a reason for hiding this comment

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

Thanks. I've moved these strings to be block-specific in f83ebdc. Let me know if you think that's a better solution for right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe we can plan ahead and make it a general translation string as well. As it's likely that we might add more of those block padding options in the future.

So I would just add a new heading here:

@@ -1,12 +1,26 @@
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'announcement' -%}
{%- style -%}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah you're right with that approach 👍
Because we're looping through blocks and they each need their own styling, it makes sense to do it here and the way you did.

@@ -1,12 +1,26 @@
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'announcement' -%}
{%- style -%}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there could be an approach maybe using CSS custom properties 🤔
Having a general declaration referencing a custom property which is different/updated per blocks.
But I wonder if it would be beneficial. It could prevent outputting the whole declaration for every block but it's not like merchant use 27 announcement bars.

sections/announcement-bar.liquid Outdated Show resolved Hide resolved
},
{
"type": "header",
"content": "t:sections.all.padding.section_padding_heading"
Copy link
Contributor

Choose a reason for hiding this comment

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

I kinda feel like it would either need to be named differently or only apply to the container/section for now.

Otherwise it's introducing a pattern that doesn't quite match the rest.

We could have a look at offering that same option of padding on blocks but across the theme 🤔

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.

Looks good, I would just tweak the translation part and then we can request translations 👍

Comment on lines 96 to 106
"label": "t:sections.announcement-bar.blocks.announcement.settings.padding.padding_top",
"default": 10
},
{
"type": "range",
"id": "padding_bottom",
"min": 0,
"max": 100,
"step": 2,
"unit": "px",
"label": "t:sections.announcement-bar.blocks.announcement.settings.padding.padding_bottom",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can go back to what you had before here so: t:sections.all.padding.padding_top and t:sections.all.padding.padding_bottom

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, thanks! Should be all set now and ready for a re-review.

ludoboludo
ludoboludo previously approved these changes Jul 4, 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.

Looking good 👍 Ill request translations and re approve when they're all back in

@translation-platform
Copy link
Contributor

translation-platform bot commented Jul 5, 2022

We have received a translation request but there is a question blocking translation work. Your help is needed.

Click the following links to answer the questions

⚠️ Replying directly to this comment in GitHub will not work! 🙅‍♀️


Not your issue?

Forward the issue to someone with more context; please don't leave this pending. 🙏

Questions?

Hop in the #help-i18n-and-translation Slack channel.

ludoboludo
ludoboludo previously approved these changes Jul 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.

👌

@andrewetchen
Copy link
Contributor

andrewetchen commented Jul 27, 2022

Hey team,

The probot-CLA was recently deprecated and replaced with the shopify-cla action.

To successfully use the new shopify-cla status check, this PR will be closed and reopened.

Thanks and sorry for the minor inconvenience. Message me if you have any questions 😄

Please refer to the following for more information:

@@ -360,6 +360,7 @@
"sections": {
"all": {
"padding": {
"block_padding_heading": "Block padding",
Copy link
Contributor

Choose a reason for hiding this comment

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

Localization quality issue found

The following issues may affect the quality of localized translations if they are not addressed:

  • The value Block padding for key sections.all.padding.block_padding_heading is very short. Short strings are more likely to be misunderstood by translators without context. Please provide additional context for the translators if possible.

Please look out for other instances of this issue in your PR and fix them as well if possible.

Questions about these messages? Hop in the #help-localization Slack channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants