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

Card image border radius #1764

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

Card image border radius #1764

wants to merge 9 commits into from

Conversation

allylane
Copy link
Contributor

@allylane allylane commented Jun 2, 2022

Editor

Fixes this issue
Apply media settings to images in Multicolumn.
Screen Shot 2022-06-02 at 11 39 58 AM
Screen Shot 2022-06-02 at 11 39 48 AM
Screen Shot 2022-06-02 at 11 39 40 AM
Screen Shot 2022-06-02 at 11 39 27 AM

There's currently no way of applying borders, border radius, or shadows to images in multicolumn layouts. This PR introduces them through media settings.

What approach did you take?
I applied the variables for media settings to .multicolumn-card__image, and I overrode border radius for .multicolumn-card__image if image ratio was set to circle

Other considerations
Multicolumn is sometimes used for Logos. If the theme has media borders, the logos will get those borders which may be less desirable for that specific scenario.

Testing steps/scenarios

  • Add an image to a multcolumn
  • Change Media settings

Alistair Lane added 2 commits June 2, 2022 11:05
Have card images inherit styles from media.
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.

This is great thanks for taking this initiative for fixing it! This would solve this following issue #1525, if you can add it to the PR description! 🙏

I think we should still apply shadow for the Circle image ratio because otherwise it won't be predictable for merchants. We've been avoiding this kind of magic where merchants don't have control and want to rely on other ways to invest these kind of exceptions to the rule.

While testing I uncover:

@allylane
Copy link
Contributor Author

allylane commented Jun 7, 2022

@melissaperreault I know what's causing that. I might have to rethink the approach to avoid it.

@allylane
Copy link
Contributor Author

This is great thanks for taking this initiative for fixing it! This would solve this following issue #1525, if you can add it to the PR description! 🙏

I think we should still apply shadow for the Circle image ratio because otherwise it won't be predictable for merchants. We've been avoiding this kind of magic where merchants don't have control and want to rely on other ways to invest these kind of exceptions to the rule.

While testing I uncover:

@melissaperreault I've pushed a fix for this now. If you could take another look that'd be great!

@melissaperreault
Copy link
Contributor

melissaperreault commented Jun 14, 2022

Took another quick look! I am not sure what this is due to but the ratio don't behave the same with the application of the border and shadow to those images now. (Video reference)

@allylane
Copy link
Contributor Author

Took another quick look! I am not sure what this is due to but the ratio don't behave the same with the application of the border and shadow to those images now. (Video reference)

Thanks @melissaperreault. That's fixed, and I've also updated a couple of other spots that media show up to better represent borders and shadows.

assets/section-multicolumn.css Show resolved Hide resolved
assets/base.css Outdated
@@ -2832,8 +2834,6 @@ details-disclosure > details {
.global-media-settings--full-width,
.global-media-settings--full-width img {
border-radius: 0;
border-left: none;
border-right: none;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this meant to be removed ? It means that we're going from: current look vs after this borders declarations are removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, it was intentional, and I think it's nice for imagery to have the borders, but your screenshots highlight that it's not as desirable for text areas. I'll put it back.

Comment on lines 7 to 8
height: 100%;
width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing those create issues in places where that class is also used like the collage section: video

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok cool. thanks for picking this up.

assets/section-multicolumn.css Outdated Show resolved Hide resolved
.multicolumn-card > .multicolumn-card__image-wrapper--full-width:not(.multicolumn-card-spacing) {
border-top-left-radius: calc(var(--text-boxes-radius) - var(--text-boxes-border-width));
border-top-right-radius: calc(var(--text-boxes-radius) - var(--text-boxes-border-width));
overflow: hidden;
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 what situation it was needed for before 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, I was wondering the same. I couldn't find anything. cc/ @tyleralsbury @martinamarien

Copy link
Contributor

Choose a reason for hiding this comment

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

This makes it so that shadow within the content container is overflowing the parent:

Which doesn't look like an ideal situation.

Maybe we could apply the overflow: hidden; only when content containers has at least a 1px border 🤔

@@ -1,6 +1,6 @@
.video-section__media {
position: relative;
padding-bottom: 56.25%;
padding-bottom: calc(56.25% - var(--media-border-width) * 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change needed ? It seems to be related to the video section only 🤔

@@ -10,7 +10,7 @@
{%- when 'featured_image'-%}
{%- if article.image -%}
<div class="article-template__hero-container" {{ block.shopify_attributes }}>
<div class="article-template__hero-{{ block.settings.image_height }} media"
<div class="article-template__hero-{{ block.settings.image_height }} media global-media-settings"
Copy link
Contributor

Choose a reason for hiding this comment

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

Here I can see how it can be useful to add to articles 👍
Could you add something in the PR description for it as it doesn't currently mentions that there are edits for this section/template.

@@ -35,7 +35,7 @@
>
<div class="card__inner {% if settings.card_style == 'standard' %} color-{{ settings.card_color_scheme }} gradient{% endif %}{% if article.image and show_image or settings.card_style == 'standard' %} ratio{% endif %}" style="--ratio-percent: {{ 1 | divided_by: ratio | times: 100 }}%;">
{%- if show_image == true and article.image -%}
<div class="article-card__image-wrapper card__media">
<div class="article-card__image-wrapper card__media global-media-settings">
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here, if you could add this to your description so that folks reviewing know which part to test.

Here there is more tweaks needed I think depending on the card setup (standard or card).

Also this element would need a border radius applied on it as well otherwise it's not reflecting what the settings are: video

Maybe it we can only tackle multicolumn in the PR to keep it simple and explore the other situation touched here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, I may have tackled 1 too many things with this PR

@allylane
Copy link
Contributor Author

@ludoboludo would you mind taking another pass through this with the updates I've made?

}

.media--circle {
left: calc(-1 * var(--button-size));
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious to know what this was added for ? 🤔
I don't think we have a --button-size variable declared anywhere else so I don't think this declaration is changing anything.
But let me know if I'm missing something.

@@ -1196,7 +1196,6 @@ summary::-webkit-details-marker {
display: block;
background-color: rgba(var(--color-foreground), 0.1);
position: relative;
overflow: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

I tend to get a little worried when removing properties that have impact on many elements. I see that we need to remove this in order for the shadow to come up for multicolumn but maybe instead of removing the property here we could overwrite it in the section-multicolumn.css file with something like:

.multicolumn-card .media {
  overflow: inherit;
}

I feel like it's more "backward compatible".

.multicolumn-card > .multicolumn-card__image-wrapper--full-width:not(.multicolumn-card-spacing) {
border-top-left-radius: calc(var(--text-boxes-radius) - var(--text-boxes-border-width));
border-top-right-radius: calc(var(--text-boxes-radius) - var(--text-boxes-border-width));
overflow: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes it so that shadow within the content container is overflowing the parent:

Which doesn't look like an ideal situation.

Maybe we could apply the overflow: hidden; only when content containers has at least a 1px border 🤔

@andrewetchen
Copy link
Contributor

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:

@andrewetchen andrewetchen reopened this Jul 27, 2022
@martinamarien martinamarien removed their request for review March 6, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply Media global setting to Multicolumns' media
5 participants