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 new text and overlay settings to image with text #944

Merged
merged 18 commits into from
Dec 15, 2021

Conversation

martinamarien
Copy link
Contributor

@martinamarien martinamarien commented Nov 24, 2021

Why are these changes introduced?
This PR adds new settings to the image with text section:

  1. Horizontal Text alignment (mobile and desktop)
  2. Vertical text alignment
  3. Overlay text box
  4. Image size

fixes #945

What approach did you take?

1. Horizontal Text alignment (mobile and desktop)
Used text-align to change text position.

2. Vertical text alignment
Used flexbox for the vertical alignment of the text inside of the standard layout and for the overlap layout.

3. Overlay text box
I decided not to use position: absolute for this layout. The reason being: if the text were to expand below or above the image, it would overlap content above/below it. Instead, I used flexbox and height: auto to allow text box to collapse.

Behaviour of text box when content position is set to:

  • Top: The textbox will remain 3rem below the top of the image, and the textbox will grow downward on resize or if the text is larger than the image height.
  • Bottom: The textbox will remain 3rem above the bottom of the image, and the textbox will grow upward on resize or if the text is larger than the image height.
  • Cental: The textbox will remain in the middle relative to the image. The text box will grow up and down on resize or if text is larger than the image height, so that the image is always centered relative to the textbox.

4. Image size
Leveraged our grid system and flexbox to ensure image/text grows as needed to take up remaining 2/3 of the space for the small and large settings.

Demo links
See demo shop

Checklist

@martinamarien martinamarien self-assigned this Nov 24, 2021
@martinamarien martinamarien force-pushed the update-image-with-text-off-main branch from 2f2cfe8 to c6429d6 Compare November 24, 2021 16:14
@martinamarien martinamarien marked this pull request as ready for review November 24, 2021 16:44
@tyleralsbury tyleralsbury self-requested a review November 29, 2021 15:23
@martinamarien martinamarien force-pushed the update-image-with-text-off-main branch from fb8756c to 021ca49 Compare November 30, 2021 15:20
@martinamarien martinamarien force-pushed the update-image-with-text-off-main branch from 021ca49 to 4318001 Compare November 30, 2021 15:22
@martinamarien
Copy link
Contributor Author

martinamarien commented Nov 30, 2021

Updates

  • Full bleed background when "no-overlay" is selected. Pngs now use the right color scheme background color.
  • Image uses the theme background color (background 1) when "no-overlap" is selected.
  • Image with text now has a subtitle block to give merchants more flexibility with their text layout/hierachy.

Copy link
Contributor

@tyleralsbury tyleralsbury left a comment

Choose a reason for hiding this comment

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

First pass looks good. There's a minor spelling issue, but testing + code look great. Will wait for UX to review and give feedback before finalizing my review.

@ludoboludo ludoboludo self-requested a review November 30, 2021 19:10
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 very cool. I like this new flexibility and cool looking design with the overlap 👌


.image-with-text--overlap .image-with-text__text-item {
display: flex;
padding: 3rem 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 might want to remove this padding only at the top, only at the bottom or both depending on the desktop content position: screenshot.

Since we already have the margin on the section at the top and 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 still believe this is something to address to make sure we don't have unwanted space

@@ -958,7 +958,21 @@
"options__3": {
"label": "Large"
},
"label": "Image ratio"
"label": "Image height",
"info": "Determines section height."
Copy link
Contributor

Choose a reason for hiding this comment

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

Here if the text box is long due to content it makes the image adapts to the space its given. So say you have chosen adapt to image and the content is long, then your image isn't fully shown anymore (depending on the aspect ratio).

Should it keep it's aspect ration and be aligned vertically or we keep it as is ? I think this behaviour is similar for another section where there is a min-height set. So it won't technically, always be Adapted to the first image.

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 expected, and it already behaves this way. It's based on the image aspect ratio. If we always want the full width of the image to be visible, then the entire section would need to be revisited because the section's behaviour (no-overlap) is based on the image being the same height as the text. I'll leave this as is, and talk to Wik about this as a follow up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah sounds good 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Does "Adapt to content" or something similar make more sense? The behaviour looks solid but the content might be a bit misleading. No strong opinions.

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 don't think it's adapting to content though. So the height of the image is based on the image height setting - and in this case it's adapting to the image height, but the width is determined by another setting.

"options__2": {
"label": "Overlap"
},
"label": "Content layout"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be useful to have an option to choose what is going to be "in front" ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this suggestion - being able to choose how they layer can unlock new effects.

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 will add this as something to consider as a follow up. Particularly because we are not offering a way to modify the overlap value and it could result in text being covered.

"label": "Overlap"
},
"label": "Content layout"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, just an idea to throw out there. Adding a setting for people use the CSS property clip-path could be cool. Maybe overkill 😅 but that would allow some potential neat layouts:

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be sick but to really do it properly, we would need to have some interface (similar to gradients) in the editor for creating these shapes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah for sure. Though it seems that what triggers the change is to have a rough implementation of it first maybe 🤔 But it doesn't make for the best experience for merchants.

Copy link
Contributor

Choose a reason for hiding this comment

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

The neat thing too is that you can do clip path based on an svg path. And have even cooler effects: blobs, dots patterns, etc. There are some cool example in Sara Soueidan's article.

@katycobb
Copy link
Contributor

katycobb commented Dec 3, 2021

@martinamarien

-The Desktop Content Position setting seems to be moving the image, not the text/button/container. I think this is opposite behavior to other sections like slideshow? Note: this only happens when I choose “Small” for image height.

-Question: what is the default behavior on mobile for Content Position? Since there isn’t a mobile-specific setting, we might want to add help text under Desktop Content Position to describe what to expect on mobile. (Following the same pattern of the Desktop image placement and Desktop image width settings)

tyleralsbury
tyleralsbury previously approved these changes Dec 8, 2021
Copy link
Contributor

@tyleralsbury tyleralsbury left a comment

Choose a reason for hiding this comment

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

Approving. Let me know if it goes stale - everything looks good to me.

@@ -60,4 +60,4 @@
}
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure when or where it was removed, but we should keep the trailing new line to prevent conflicts in this file in the long term.

Suggested change
}
}

@@ -103,4 +103,4 @@
"video",
"multi_column"
]
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same deal here.

Suggested change
}
}

@katycobb
Copy link
Contributor

katycobb commented Dec 8, 2021

@martinamarien just jammed with Wik - we'd like to add help text under the Desktop content position field to explain how this behaves on mobile: Position is automatically optimized for mobile.

Let me know if you need more info! cc @wiktoriaswiecicka

@melissaperreault
Copy link
Contributor

👋 Not sure if this is relevant to this PR, it can be tackled on another one.

cc. @wiktoriaswiecicka

tyleralsbury
tyleralsbury previously approved these changes Dec 14, 2021

.image-with-text--overlap .image-with-text__text-item {
display: flex;
padding: 3rem 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 still believe this is something to address to make sure we don't have unwanted space

}

.image-with-text--overlap .image-with-text__content {
transform: translate(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.

This I think creates some extra space on mobile. Seems like using a negative margin-top makes it better: video

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. Tested on iOS as well and no issues noticed.

I wonder if a medium size option should be added for the Image height settings 🤷 but that can easily be added in the future if needed.

I think it could be useful when the image you're dealing with is portrait and long. You don't end up having an option that is between small and large since the aspect ratio makes adapt to image be as large as the large option or bigger.

@martinamarien martinamarien merged commit a0fd1a3 into main Dec 15, 2021
@martinamarien martinamarien deleted the update-image-with-text-off-main branch December 15, 2021 17:13
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Add new settings and translations

* add text overlay, image and text alignment css

* remove specificity and update layout setting

* update content

* update label

* Add caption-with-letter-spacing and fix translation content

* update color behaviour and add subtitle setting

* fix center spelling

* Update 11 translation files

* Update 15 translation files

* address feedback and fix content

* Update 5 translation files

* Update 15 translation files

* Update caption block styling

* Update 3 translation files

* Update 18 translation files

* Update 2 translation files

* re-add new line

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 With Text Enhancements
6 participants