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 multirow section #2168

Merged
merged 7 commits into from
Jan 12, 2023
Merged

Add multirow section #2168

merged 7 commits into from
Jan 12, 2023

Conversation

kmeleta
Copy link
Contributor

@kmeleta kmeleta commented Dec 12, 2022

PR Summary:

Added a new Multirow section for displaying related image and text content vertically.

Why are these changes introduced?

Multirow is a section conceptually similar to multicolumn, but designed specifically for quicker and easier vertical content enumeration. Its blocks are aesthetically similar to the current image with text section.

Fixes #2169

What approach did you take?

Copied the liquid from image with text into a new section, without creating a shared snippet, so much of the markup will be the same. I'm not certain the added snippet complexity that would be required to support both use cases would be worth it. This may be dependent on how each section functionally evolves in the future.

Multirow loops through blocks and creates a new image with text element for each, so the way existing content elements (heading, caption, etc) are read differs a bit from image with text. Certain image with text classes that were conditional on section settings were either removed or hardcoded if the settings are not offered in multirow.

Other considerations

Color scheme + global border settings logic (Video of behavior)
I've included the same "magic" as image with text where if the container color scheme chosen matches the section background and no borders or shadow styles are applied via global content container settings. This allows either a unified container look or a container-less/transparent look. The only difference here is that multirow also allows the option to change the section background so this logic isn't solely linked to background-1

Shadow stacking limitations (Video of behavior)
When vertical shadow offsets for either the global media or content container settings are negative (upward), the shadow could overlap the row above (natural CSS behavior) if there isn't enough gap. The issue here is there are 2 different child elements within an image with text creating their own shadows with an existing stacking relationship of their own, which further adds to the complexity that we've been able to solve for in other sections. I briefly timeboxed a fix for this and didn't find a configuration that worked, but I don't think it's blocking.

Color scheme + padding logic (Image of behavior)
We also aligned to include additional logic to better align the text content with the standard page margins when both color scheme settings are the same and the rows don't create the "container" look. Basically it just removes the appropriate left or right padding depending on the row's content alignment. An exception is also made for centered text.

Decision log

# Decision Alternatives Rationale Downsides
1 Each block is a row, rather than a single content element Basically none - To allow for multiple rows
- To allow for connection to dynamic source groups
- Content elements will not be reorder-able like image with text
2 Block content style settings at the section level Include all/more content style settings at the block level - Focus is around quick and easy configurable
- More granularity at the block level would be more tedious and time consuming
- All blocks will display with the same setting choices
3 Did not include all currently available settings from image with text Include more or all image with text settings - Focus on settings most relevant to the purpose of this section
- Less options, less configuration time for merchants
- Easier to add settings later than take some away
- Rows will not have all the same styling options as image with text (e.g overlap layout)
4 Did not reuse existing translated strings from image with text Reuse common strings and only add multirow strings when needed - Allows image with text and multirow to more easily diverge further in the future
- Keeps things simpler
- Inherent redundancy
5 Did not abstract image with text liquid into a reusable snippet Consolidate core image with text in a settings-agnostic snippet - Allows image with text and multirow to more easily diverge further in the future
- Snippet would need to be completely agnostic of section.settings and block.settings references resulting in a lot of props
- New logic specific to one component will require adding an exception in the shared snippet
- I'm not confident if shared liquid here will be beneficial or a burden
- Inherent redundancy
- New shared logic will need to be duplicated

Visual impact on existing themes

Multirow is a new section and any changes to image with text styles should be scoped to the multirow context, with one minor exception.. Long words that might not have broken in image with text captions or buttons before should break now (example)

Testing steps/scenarios

  • Test Multirow sections with various combinations of section settings
  • Ensure all settings/options are labeled correctly and behave as expected
  • Test color scheme combinations thoroughly
  • Test with different combination of global media and content container settings
  • Test with dynamic content sources (Puppy product)

Note: Image height: medium setting may not apply correctly until the PR that adds the styles for this is merged and this one is rebased.

Demo links

Checklist

@kmeleta kmeleta force-pushed the add-multirow-section branch 2 times, most recently from 02f803e to 0bc0030 Compare December 13, 2022 19:23
@kmeleta kmeleta marked this pull request as ready for review December 14, 2022 18:46
@YoannJailin
Copy link

YoannJailin commented Dec 14, 2022

Hey @kmeleta, nice work! Thank you.

Image height :

  • I tried to see the difference between each height setting with empty blocks. I looks like Medium height doesn’t work, as I obtain a super short height.

Capture d’écran, le 2022-12-14 à 16 26 28

  • Also, when set to medium, images disappears on mobile version.

Capture d’écran, le 2022-12-14 à 16 27 54

If container color and color schemes are identical : 


  • This is just a bonus improvement, nothing mandatory. Just an attempt : Can we align content on the grid? If that complicated no need to do it.

I am gonna test it out with dynamic content / meta object tomorrow. Also checking the final settings name and section icon.

@@ -327,3 +327,17 @@
margin-left: 0;
}
}

Copy link
Contributor Author

@kmeleta kmeleta Dec 14, 2022

Choose a reason for hiding this comment

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

looks like Medium height doesn’t work, as I obtain a super short height.

There's a note about this in the PR description. Medium won't work until #2148 merges because it's a new addition to the image with text code.

Can we align content on the grid? If that complicated no need to do it.

If we want to introduce the additional magic for it, then technically yes. I just wasn't sure if we were aligned to do that or not. I can add it, but we should probably align as a group on that.

@YoannJailin

Copy link
Contributor Author

@kmeleta kmeleta Dec 15, 2022

Choose a reason for hiding this comment

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

@YoannJailin padding magic has been added. Intended logic is as follows

Removes..

  • left padding on image-second rows
  • right padding on image-first rows
  • both left/right padding on mobile

If..

  • both color scheme settings match, and..
  • content container has no visible border, and..
  • content container has no visible shadow

I somewhat feel like we might also want to make an exception for text center alignment though. What do you think? Maybe this is ok if the visual result always better, but this is a combination of conditions no one would be able to predict.

Copy link

@YoannJailin YoannJailin Dec 20, 2022

Choose a reason for hiding this comment

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

Hey, logic with the 2 colour schemes being identical makes sense to me.

I somewhat feel like we might also want to make an exception for text center alignment though. What do you think? Maybe this is ok if the visual result always better, but this is a combination of conditions no one would be able to predict.

@kmeleta just to be sure, you mean the magic would not work if text is aligned center is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah basically. This is what I'm seeing with the padding removed but text centered. It just looks a little odd to me

Choose a reason for hiding this comment

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

@kmeleta I agree! Let's remove the magic on desktop when content is centered then :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YoannJailin the center alignment magic has been added. I'll be sure to capture these decisions in the PR description as well.

@ludoboludo ludoboludo self-assigned this Dec 19, 2022
Comment on lines +209 to +211
"type": "select",
"id": "desktop_content_position",
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 might need to add a similar setting for the image 🤔 Right now it stretches based on the length of the content. And it seem weird that it'd do that since we have a specific image height setting for it but it doesn't end up respecting it, in this scenario:

Screenshot

Copy link
Contributor Author

@kmeleta kmeleta Dec 21, 2022

Choose a reason for hiding this comment

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

Hmm, well it's always been more of a minimum image height effect in image with text, so functionally this is expected. The reason for this I imagine is because if you have more of the "container" look configured, restricting the image height would look a little weird.

I doubt we'd want to add another setting into the mix right now regardless, but the question of preventing the height from growing in certain cases is worth at least asking. IMO this probably isn't necessary to account for, but this would be more of @YoannJailin's call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that could be something we do a follow up on if we see an actual need for it and if merchants do use longer texts.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to use a follow up PR for this one so we can manage both Image with text and Multirow logic at the same time. Thoughts?

Choose a reason for hiding this comment

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

I agree, let's not change the behavior we reused from Image with text. We can correct it on both sections later on.

Rusty-UX
Rusty-UX previously approved these changes Jan 4, 2023
Copy link

@Rusty-UX Rusty-UX left a comment

Choose a reason for hiding this comment

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

From the side of content experiences UX this is great! No blocking feedback.

Works really well, and optional captions also work great. Feel free to try it out on my store

image

@Rusty-UX
Copy link

Rusty-UX commented Jan 4, 2023

Adding non-blocking feedback here

  • For storefronts integrations team: When testing I noticed that if I used title it didn't map to heading but to the first field is it possible to make that smarter?

  • I didn't see any options to allow for greater spacing between the rows - not blocking but is that something we'd consider adding?

},
{
"type": "inline_richtext",
"id": "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.

Thanks for taking a look @Rusty-UX

For storefronts integrations team: When testing I noticed that if I used title it didn't map to heading but to the first field is it possible to make that smarter?

Is it looking for the label or the id or what? Would be great if it was smarter, but would things sync up any better if I changed this setting id for the heading to title instead of heading or no?

I didn't see any options to allow for greater spacing between the rows - not blocking but is that something we'd consider adding?

We decided to tie that into our global grid settings.

I'm questioning the specific language of the helper text that mentions multicolumn, but it will end up mentioning multirow there in some way.

Copy link
Contributor

@melissaperreault melissaperreault Jan 5, 2023

Choose a reason for hiding this comment

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

We are looking into the content for that helper text to clarify that. I've been thinking about replacing it with something close to: Affects areas with multiple columns or rows. but still need validation from Katy. 🙏

Choose a reason for hiding this comment

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

Sorry for the delay.

@kmeleta I don't think we should change anything on naming based on our mapping algorithm. I think it's fine. If heading is the best UX for merchants in editor we should use that.

Background context on how mapping works if interested:

  • We check the types first - and only compatible types can be mapped - e.g. file->image field → image setting (In the case of text we have a few potential compatible settings)
  • Then we check the name of the field and the name of the setting, and check their similarity in name, and score that - based on the closeness of the names we match them.

dan-menard
dan-menard previously approved these changes Jan 4, 2023
Copy link
Member

@dan-menard dan-menard left a comment

Choose a reason for hiding this comment

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

👍 🎩 Nice work!

Code looks good to me, and thanks for putting the changes right on the os2 store, that made playing with it a bunch easier 😄

@kmeleta
Copy link
Contributor Author

kmeleta commented Jan 6, 2023

Updated settings with Katy-approved copy (13cc4f2) @melissaperreault @ludoboludo if one or both of you could verify those I'll request translations.

@kmeleta kmeleta force-pushed the add-multirow-section branch from c249130 to 5e20ba4 Compare January 9, 2023 15:18
@kmeleta kmeleta force-pushed the add-multirow-section branch from 5e20ba4 to 13cc4f2 Compare January 9, 2023 15:23
dan-menard
dan-menard previously approved these changes Jan 9, 2023
@YoannJailin
Copy link

YoannJailin commented Jan 9, 2023

Hello @kmeleta ! Just noticed something.

Let's say the container color scheme and color scheme have the same color : It means that the container disappears, and we have that magic that puts the text content on grid (removing the gabs on each side).

If we go on mobile, it's the same logic. But i noticed that if the Desktop content alignment is set to center, it impacts the mobile version (the gaps on each side of the text reappears) is there something we can do about that?

@translation-platform
Copy link
Contributor

translation-platform bot commented Jan 10, 2023

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

Please answer the following questions.

Warning
Replies in GitHub are not visible to translators. Use the provided "Answer here" links. 🙅‍♀️


Note
Not your issue? Forward it to someone with more context; please don't leave it pending. 🙏
Questions? Hop in the #help-i18n-and-translation Slack channel.

@ludoboludo ludoboludo self-requested a review January 10, 2023 14:44
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.

A few small comments but otherwise looking good 👍

Comment on lines 332 to 348
@media screen and (max-width: 749px) {
.collapse-padding .image-with-text__grid .image-with-text__content {
padding-left: 0;
padding-right: 0;
}
}

@media screen and (min-width: 750px) {
.collapse-padding .image-with-text__grid:not(.image-with-text__grid--reverse) .image-with-text__content {
padding-right: 0;
}

.collapse-padding .image-with-text__grid--reverse .image-with-text__content {
padding-left: 0;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this seem to be multirow specific, I think it would make sense to move it down under the

/*
  Multirow
  note: consider removing from this stylesheet if multirow-specific styles increase signficantly
*/

What do you think ?

Copy link
Contributor Author

@kmeleta kmeleta Jan 10, 2023

Choose a reason for hiding this comment

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

It might end up making its way to image with text as well so I did it generically, though I'm not going to do that in this commit regardless. I wonder if it's worth moving it temporarily as a reminder 🤔

@YoannJailin @melissaperreault do either of you remember if we discussed applying the new padding magic to image with text in the future? I wouldn't add it in this PR but is that something we'd likely want to do? (The stuff in this thread)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think so. This is improving for when both the container and the website background have the same color and the alignment of text requires a shift to maintain an invisible vertical alignment line. But in a follow up PR, agreed!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Captured image with text work in an issue #2208

</p>
{%- endif -%}
{%- if block.settings.heading -%}
<h2 class="image-with-text__heading {{ section.settings.heading_size }} rte">
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 need to call the component-rte.css stylesheet in here in case there are no other section calling it 🤔
Though by now it feels like we should load it by default in theme.liquid since most sections seem to use 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.

mmm good catch. I've just included it in multirow for now, but yeah I wonder.. If we're going to load it in theme.liquid, is it worth just adding the styles to base.css? Probably don't want to consider that type of change here, but maybe I'll capture this in an issue to be fully considered in terms of css loading performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a tech debt issue to track here separately #2209

<div class="image-with-text__content image-with-text__content--{{ section.settings.desktop_content_position }} image-with-text__content--desktop-{{ section.settings.desktop_content_alignment }} image-with-text__content--mobile-{{ section.settings.mobile_content_alignment }} image-with-text__content--{{ section.settings.image_height }} content-container{% unless no_content_background and no_content_styles %} gradient color-{{ section.settings.row_color_scheme }}{% endunless %}">
{%- if block.settings.caption -%}
<p class="image-with-text__text image-with-text__text--caption caption-with-letter-spacing caption-with-letter-spacing--medium">
{{ block.settings.caption | escape }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note of longer words that don't break. It's more general than specific to this PR though:

Screenshot

Copy link
Contributor Author

@kmeleta kmeleta Jan 10, 2023

Choose a reason for hiding this comment

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

I solved this by making the existing image with text word break styles less specific 8470fda. Not sure I want to attempt to apply these more globally here, though off the top of my head I'm not sure I can think of a scenario we wouldn't want a caption or button to break. What do you think about that?

Copy link
Contributor

@melissaperreault melissaperreault Jan 11, 2023

Choose a reason for hiding this comment

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

Caption and button should break, yes! We don't want content to fall off screen. 🙏

},
{
"type": "select",
"id": "image_layout",
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it a bit odd to have the setting that has the most visual impact on the section show up so late in the order. But because it's a desktop only setting that's maybe why I guess ?
cc: @YoannJailin

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 know we discussed this before and we were trying to keep our pattern consistent, but I've always felt this way too. Though we do default it to the alternating layout at least so the main distinguishing feature in the section will still be easily discoverable in that way.

Copy link
Contributor

Choose a reason for hiding this comment

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

To align with other sections, the layout specific settings often comes at this level like it is. I think we have plenty to learn from those settings usage regardless. Thanks for this valid feedback and let's keep observing and sharing those thoughts! 🙏

@kmeleta
Copy link
Contributor Author

kmeleta commented Jan 11, 2023

@YoannJailin @melissaperreault I fixed some issues around the padding magic in mobile. Please review these behaviors (with text aligned left, center, and right) on mobile (and desktop I guess) and ensure the padding is the way we expect. It will be different than image with text currently.

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!
Looks good for spacing, although we are creating a precedent to update the rest of the other sections that could benefit from the same logic. Image with text, Multicolumn, Richtext when not in full width, etc)

@kimberlyoleiro
Copy link

@melissaperreault to your last comment, this would be a great example of a ticket/task to add to the design polish board

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 👍

@kmeleta kmeleta requested a review from dan-menard January 11, 2023 21:15
@kmeleta kmeleta merged commit 475f348 into main Jan 12, 2023
@kmeleta kmeleta deleted the add-multirow-section branch January 12, 2023 16:19
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Add multirow section

* Border collapse logic and general cleanup

* Conditionally remove content padding

* Reviewer feedback and formatting

* Setting and info updates

* Minor feedback

* Update 20 translation files

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.

Multirow section
8 participants