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 image banner settings #900

Merged
merged 49 commits into from
Dec 7, 2021
Merged

Add image banner settings #900

merged 49 commits into from
Dec 7, 2021

Conversation

KaichenWang
Copy link
Contributor

Why are these changes introduced?

Fixes #890

What approach did you take?

  • Add setting to schema for Text alignment
  • Add options to existing setting Desktop text position to enable horizontal positioning
  • Clean up CSS (especially related to banner button layout)
  • Rely on applying setting values directly as CSS property values, instead of relying on adding them as element class
    modifiers (See "Other considerations")

Other considerations

Before
Use setting value to set element class modifier. Then use CSS to target class modifiers.

/* Liquid */

banner__content--{{ section.settings.desktop_text_box_position }}

/* CSS */

.banner__content--center {
  align-items: center;
}

.banner__content--flex-start {
  align-items: flex-start;
}

.banner__content--flex-end {
  align-items: flex-end;
}

After
Use setting value directly in CSS. This requires less code overall if there are multiple options.

/* Liquid style tag */

#Banner-{{ section.id }} .banner__content {
  align-items: {{ section.settings.desktop_text_box_position | split: " " | first }};
  justify-content: {{ section.settings.desktop_text_box_position | split: " " | last }};
}

Demo links

Checklist

@KaichenWang KaichenWang added the Category: Enhancement New feature or request label Nov 17, 2021
@KaichenWang KaichenWang reopened this Nov 17, 2021
@ghost ghost added the cla-needed label Nov 17, 2021
.banner__buttons {
display: inline-flex;
flex-wrap: wrap;
gap: 1rem;
Copy link
Contributor Author

@KaichenWang KaichenWang Nov 17, 2021

Choose a reason for hiding this comment

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

We may need to use margin instead, since flex gap isn't supported in all latest (and latest -1) browser versions. Although the previous implementation already uses this property https://github.com/Shopify/dawn/pull/900/files#r751679171

Copy link
Contributor

Choose a reason for hiding this comment

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

Something here to keep in mind / double check 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Gap is being used across the theme in many other files 🤔 maybe we can make an audit

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. To note is that the gap property is well supported for grid layout but less for flexbox ones.

Copy link
Contributor

Choose a reason for hiding this comment

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

Created an issue here :) #964

.banner__box > .banner__buttons {
display: flex;
align-items: baseline;
gap: 1rem;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screen Shot 2021-11-17 at 5 13 45 PM

@sofiamatulis sofiamatulis self-assigned this Nov 18, 2021
@sofiamatulis
Copy link
Contributor

I will be taking over this section now :)

@sofiamatulis sofiamatulis mentioned this pull request Nov 18, 2021
5 tasks
@sofiamatulis
Copy link
Contributor

We now have settings for mobile text alignment as well.

https://screenshot.click/19-31-0q6f8-wk4nx.png

@wiktoriaswiecicka Not sure if this should be under mobile layout?

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. Just noticed an issue with button alignment.

sections/image-banner.liquid Outdated Show resolved Hide resolved
sections/image-banner.liquid Outdated Show resolved Hide resolved
assets/section-image-banner.css Show resolved Hide resolved
sections/image-banner.liquid Outdated Show resolved Hide resolved
assets/section-image-banner.css Outdated Show resolved Hide resolved
assets/section-image-banner.css Outdated Show resolved Hide resolved
assets/section-image-banner.css Outdated Show resolved Hide resolved
@sofiamatulis
Copy link
Contributor

The content has been updated:

  • updated order
  • replaced text with content
  • updated default values

cc @wiktoriaswiecicka @ludoboludo

@@ -1,3 +1,36 @@
.email-signup-banner .newsletter-form,
Copy link
Contributor

Choose a reason for hiding this comment

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

@melissaperreault @wiktoriaswiecicka What do you think of updating the label for the mobile alignment? Or maybe it's clearer to keep it 🤔

Original comment

#916 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Aligned it shouldn't say mobile under the "mobile" header.

Copy link

Choose a reason for hiding this comment

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

I am late to the party! But as discussed in today's UX review, we'll keep "mobile" under mobile header for clarity.

@sofiamatulis
Copy link
Contributor

Updated both sections email banner and image banner to have text style setting:

https://screenshot.click/25-15-4nx4s-9rbj1.png

cc @wiktoriaswiecicka @melissaperreault

@ghost ghost removed the cla-needed label Dec 3, 2021
Comment on lines +192 to +241
@media screen and (min-width: 750px) {
.banner__content {
padding: 5rem;
}

.banner__content--top-left {
align-items: flex-start;
justify-content: flex-start;
}

.banner__content--top-center {
align-items: flex-start;
justify-content: center;
}

.banner__content--top-right {
align-items: flex-start;
justify-content: flex-end;
}

.banner__content--middle-left {
align-items: center;
justify-content: flex-start;
}

.banner__content--middle-center {
align-items: center;
justify-content: center;
}

.banner__content--middle-right {
align-items: center;
justify-content: flex-end;
}

.banner__content--bottom-left {
align-items: flex-end;
justify-content: flex-start;
}

.banner__content--bottom-center {
align-items: flex-end;
justify-content: center;
}

.banner__content--bottom-right {
align-items: flex-end;
justify-content: flex-end;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to go below the .banner__content class below. Otherwise the setting doesn't work on desktop because it's always overwritten by the value below.

Copy link
Contributor

@martinamarien martinamarien left a comment

Choose a reason for hiding this comment

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

I found one issue and a setting we need to update. I know Ludo has already approved, so we can merge it but we need to make a PR right after to fix address two things:

  1. The desktop content position section isn't working for both sections.
  2. text_style alignment. I think we should remove this for the email signup section. We can touch base with Wik and Meli, but if the plan is to remove this for this setting type, I'd like to remove it before the release this week.

{
"value": "caption-with-letter-spacing",
"label": "t:sections.email-signup-banner.blocks.paragraph.settings.text_style.options__3.label"
}
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 we are going to remove this style from text blocks
Do we want to wait until we add the caption block to remove it? If so, I think we should increase the size of the uppercase font because it's 10px currently.
cc. @melissaperreault @wiktoriaswiecicka


.banner--desktop-transparent .email-signup-banner__box--no-image .field__button:focus-visible {
outline: 0.2rem solid rgba(var(--color-base-text), 0.5);
outline-offset: 0.3rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

I was just suggesting removing the outline-offset: 0.3rem; line, as it's directly assigned to all elements that can receive :focus-visible. I know we will need the Outline and box-shadow properties 👍🏻

@sofiamatulis sofiamatulis merged commit 8cf0d7b into main Dec 7, 2021
@sofiamatulis sofiamatulis deleted the add-image-banner-settings branch December 7, 2021 19:23
@sofiamatulis sofiamatulis mentioned this pull request Dec 7, 2021
5 tasks
sofiamatulis pushed a commit that referenced this pull request Dec 8, 2021
@sofiamatulis sofiamatulis mentioned this pull request Dec 8, 2021
5 tasks
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
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.

Image banner - add settings
8 participants