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 height settings #695

Merged
merged 10 commits into from
Oct 8, 2021
Merged

Add image banner height settings #695

merged 10 commits into from
Oct 8, 2021

Conversation

kmeleta
Copy link
Contributor

@kmeleta kmeleta commented Sep 28, 2021

Why are these changes introduced?

Fixes #552

What approach did you take?

Replaced fixed heights with setting specific values using a banner--<size> class.

Also included a banner box width update for widescreens.

Demo links

Checklist

@kmeleta kmeleta marked this pull request as ready for review September 28, 2021 15:36
Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

Thank you so much Ken!

Took a first bite at it and let's keep having a different max-height value for all the setting options on mobile!

Here is what I had in mind for mobile:

  • Small = 28rem
  • Medium = 34rem
  • Large = 39rem

I am continuing to investigate the info text language and the behaviour for when the setting Adapt section height to first image size is set to true.

@sofiamatulis sofiamatulis mentioned this pull request Sep 28, 2021
5 tasks
@@ -863,7 +876,8 @@
"label": "Show text below images"
},
"adapt_height_first_image": {
"label": "Adapt section height to first image size"
"label": "Adapt section height to first image size",
"info": "Overwrites image banner height setting when checked."
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll keep this for now but we know that moving this setting inside the Image banner height setting would be a better enhancement for merchants but would require a breaking change. Took a note about it over here to consider later.

@kmeleta kmeleta force-pushed the image-banner-height branch from ccaea9a to b92d99c Compare September 29, 2021 16:03
@kmeleta
Copy link
Contributor Author

kmeleta commented Sep 29, 2021

Small = 28rem
Medium = 34rem
Large = 39rem

@melissaperreault mobile heights added, let me know how they look. I definitely think this works better than sharing the desktop values.

@melissaperreault
Copy link
Contributor

melissaperreault commented Sep 29, 2021

Following our IRL chats, when testing the most up to date section settings including the one merged here #663, I have one last request to make to adjust the box max-width for wider screens.

  • For that scenario, when the box is displayed only on desktop, I tested 90rem and looks better for wide screen (Screen recording). When the box isn't displayed, the max-width is already good!

@KimliW
Copy link

KimliW commented Sep 30, 2021

@melissaperreault Can I get some clarification on this please? I need the heights for each setting (small medium large) for desktop and mobile for the Help Center docs.

@kmeleta
Copy link
Contributor Author

kmeleta commented Sep 30, 2021

Hey @KimliW, these are the heights for each of the setting options as it stands. The setting currently defaults to Medium

Tablet/Desktop:
Small: 420px
Medium: 560px
Large: 720px

Mobile:
Small: 280px
Medium: 340px
Large: 390px

Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

Thank you Ken! Looking real good! 🎉

Copy link
Contributor

@sofiamatulis sofiamatulis 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 👍 Added small comments

@@ -277,6 +305,12 @@
}
}

@media screen and (min-width: 1400px) {
.banner__box {
max-width: 90rem;
Copy link
Contributor

@sofiamatulis sofiamatulis Oct 4, 2021

Choose a reason for hiding this comment

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

Was this PR rebased? Just want to ensure this change has the up to date changes from the width PR since I see a max-width added here.

Max width added on the other PR: https://github.com/Shopify/dawn/pull/663/files#diff-8a48cf1c4c77bd24f3d47ceac2c19b0149a25b33c5e4f3d3155d249448ffdcfaR268-R272

cc @melissaperreault

Copy link
Contributor Author

@kmeleta kmeleta Oct 4, 2021

Choose a reason for hiding this comment

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

Yeah it should have been rebased onto that banner width pr. This change was a follow up to those changes for widescreens from Meli. I should have updated the pr description to mention that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct, combined with the changes to the height created here, I saw an opportunity to polish the final outcome combined with the other PR 👌

],
"default": "medium",
"label": "t:sections.image-banner.settings.image_height.label",
"info": "t:sections.image-banner.settings.image_height.info"
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe youll need to request translations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For sure, I figure I should make sure the language added looks good to at least one dev before I request.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it looks good! :) I would confirm with @melissaperreault and @gretchen-willenberg if there are any changes that need to be made before requesting 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 are good to go for now! Thanks! 🙏

@ludoboludo ludoboludo self-requested a review October 4, 2021 16:35
ludoboludo
ludoboludo previously approved these changes Oct 4, 2021
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.

Couple comments but looked good to me.

}

.banner--large:not(.banner--mobile-bottom):not(.banner--adapt) .banner__content {
min-height: 39rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

those could maybe be grouped with the styling declaration above on line 8, 13, 18 ?

@@ -161,10 +187,12 @@

.banner__content--flex-start {
align-items: flex-start;
padding-bottom: 15rem;
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 we would run into any odd scenarios when the image is wider than its height. It would only zoom in a little so I don't think it's an issue 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure I understand the use case @ludoboludo , do you mind testing it?

Copy link
Contributor

Choose a reason for hiding this comment

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

You bet, here is what I mean. Video

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with Ludo, when the "adapt" setting is enabled, the image should keep its intrinsic ratio. Unless textbox content overflows, in which case the height of the image should just grow with the textbox and the ratio will need to change.

Copy link
Contributor

@melissaperreault melissaperreault Oct 8, 2021

Choose a reason for hiding this comment

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

Thank you Ludo for explaining! Agreed that we are ok! 👌

Although, I am noticing something that I want to test, if I remove the box, the text and buttons should be vertically centered on the banner. I might have missed this detail during my review. 🤔

edit: 😵‍💫 Forget what I said! We have a setting to set the content position on the banner that I forgot for 1 minute! 😅

"options__3": {
"label": "Large"
},
"info": "For best results, use an image with a 2:3 aspect ratio. [Learn more](https://help.shopify.com/en/manual/shopify-admin/productivity-tools/image-editor#understanding-image-aspect-ratio)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Also I wonder, is 2:3 the aspect ratio we recommend ? Not 3:2 ? Since this section seem to be more for landscape images rather than portraits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch Ludo, Aligned with reverting the numbers to 3:2

Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to check if we did this mistake on other sections where we mention 2:3 🤔 Taking a note to look for later!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like featured and main blog uses the same 2:3 note. If those also should be updated, we can probably handle them all in a follow up so we don't have to re-request translations here.

Copy link
Contributor

@melissaperreault melissaperreault Oct 7, 2021

Choose a reason for hiding this comment

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

Aligned! And yes, they should both be 3:2 too.

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 👌 Follow up PR it is. It could maybe be added on the new section for the password page as well that Sofia is working on: #698 (comment)

Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

🚢 🎉

Copy link
Contributor

@KaichenWang KaichenWang 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! Left a suggestion + comment

@@ -161,10 +187,12 @@

.banner__content--flex-start {
align-items: flex-start;
padding-bottom: 15rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with Ludo, when the "adapt" setting is enabled, the image should keep its intrinsic ratio. Unless textbox content overflows, in which case the height of the image should just grow with the textbox and the ratio will need to change.

@@ -5,25 +5,58 @@
}

@media screen and (max-width: 749px) {
.banner--mobile-bottom:not(.banner--stacked):not(.banner--adapt)
> .banner__media {
.banner--small.banner--mobile-bottom:not(.banner--adapt) > .banner__media,
Copy link
Contributor

Choose a reason for hiding this comment

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

These selectors for defining height may benefit from a refactor to ensure increased code readability and avoiding selector repetition. Something like this:

.banner--adapt {
  --image-banner-height: initial;
  --image-banner-height-desktop: initial;
}

.banner--small {
  --image-banner-height: 28rem;
  --image-banner-height-desktop: 42rem;
}

.banner--medium {
  --image-banner-height: 34rem;
  --image-banner-height-desktop: 56rem;
}

.banner--large {
  --image-banner-height: 39rem;
  --image-banner-height-desktop: 72rem;
}

@media screen and (max-width: 749px) {
  .banner--mobile-bottom > .banner__media,
  .banner--stacked:not(.banner--mobile-bottom) > .banner__media {
    height: var(--image-banner-height);
  }

  .banner:not(.banner--mobile-bottom) .banner__content {
    min-height: var(--image-banner-height);
  }
}

@media screen and (min-width: 750px) {
  .banner {
    flex-direction: row;
    min-height: var(--image-banner-height-desktop);
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not a bad thought Kai. There may be some other code around that could benefit from a similar refactor as. I'll look into creating a cleanup PR

@KaichenWang KaichenWang merged commit 844ed4a into main Oct 8, 2021
@KaichenWang KaichenWang deleted the image-banner-height branch October 8, 2021 20:44
@kmeleta kmeleta mentioned this pull request Oct 21, 2021
5 tasks
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Added new height settings

* Update mobile height styles

* Add mobile specific height values

* Add wide screen max width for banner box

* Update 8 translation files

* Update 8 translation files

* Update 1 translation file

* Update 1 translation file

* Update 1 translation file

* Update 1 translation file

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.

Image Banner: Height Setting
6 participants