-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
[img-helpers] Add/Edit Image display utilities #357
Conversation
View diff of compiled files (may take a few minutes): https://github.com/oddbird/oddleventy-built/compare/main..img-helpers |
@mirisuzanne this is ready for an initial review. I kept these "helpers" as classes instead of adding a data attribute incase we wanted to apply it to something other than the embed.figure or embed.img macros. Like the contact form uses extend-small. I also took over what was the sample page called Responsive Images to show how these examples look when applied (I think it will be helpful to have a visual guide to know what is available. This is not something in this PR, but it is related to this images sample page. I don't actually know what the difference is between the first 2 (one says no width and the other says 4410) but the secret sizes are the same and so is the visual display. The last one is using the "sizes" attribute but you can't tell from the page itself. It does have a different srcset size value. I feel like we should add some explanation to these images and why they are there, but I am not actually sure why they are all there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff here! I just have a few questions about some of the details.
content/sample/images.md
Outdated
access to the outer container. Also, the embed.figure macro is wider than the | ||
content column by default, as opposed to the `embed.img` macro. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
access to the outer container. Also, the embed.figure macro is wider than the | |
content column by default, as opposed to the `embed.img` macro. | |
access to the outer container. Note that the `embed.figure` macro extends wider than the | |
content column by default, as opposed to the `embed.img` macro. |
content/sample/images.md
Outdated
access to the outer container. Also, the embed.figure macro is wider than the | ||
content column by default, as opposed to the `embed.img` macro. | ||
|
||
### `embed.figure` without any entend class for comparison |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### `embed.figure` without any entend class for comparison | |
### `embed.figure` without any extend class for comparison |
Seems like this could also be called extend-small
- and available to other media?
content/sample/images.md
Outdated
|
||
You can add the class `img-shadow` to the `embed.figure` and `embed.img` to | ||
display a shadow around the image. This doesn't work on figure if you have a | ||
caption as the shadow will be around that entire container. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the shadows are not visible in dark mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an additional image for testing in both modes and upped the opacity a bit so you can see the shadow better.
src/scss/patterns/_alignment.scss
Outdated
.contain { | ||
display: flow-root; | ||
} | ||
|
||
[class*='align-'] { | ||
margin: var(--shim) var(--inline-margin, 0); | ||
margin: var(--shim) var(--inline-margin-right, var(--inline-margin, 0)) var(--shim) var(--inline-margin-left, var(--inline-margin, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
margin: var(--shim) var(--inline-margin-right, var(--inline-margin, 0)) var(--shim) var(--inline-margin-left, var(--inline-margin, 0)); | |
margin-block: var(--shim); | |
margin-inline-start: var(--inline-margin-start, var(--inline-margin, 0)); | |
margin-inline-end: var(--inline-margin-end, var(--inline-margin, 0)); |
A bit easier to follow? And not mixing logical/physical names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so much easier to read when we split it out.
src/scss/patterns/_alignment.scss
Outdated
--inline-margin-right: var(--gutter); | ||
|
||
float: left; | ||
max-width: 45%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we trying to approximate 50% minus some gutter? Should we do that explicitly?
max-width: 45%; | |
max-width: calc(50% - var(--inline-margin-right) / 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the width is old, but I am assuming that is what it was attempting on the previous site. Either that or a little less than half of the content column looked good 😄
src/scss/patterns/_gallery.scss
Outdated
@@ -47,6 +47,10 @@ figcaption, | |||
font-size: var(--small); | |||
font-style: italic; | |||
margin-top: var(--shim); | |||
|
|||
.extend-full & { | |||
padding-inline: var(--gutter-plus); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use var(--page-margin)
here?
src/scss/patterns/_media.scss
Outdated
max-width: 25vw; | ||
padding-inline: calc(var(--gutter) + 2vw); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These numbers feel a bit magical and unclear to me. Why 25vw? Right now, this doesn't align with anything else on the page - should it? Is the extra gutter space meant to avoid our hanging link icons on headings? If you use this next to a paragraph rather than a heading, does the extra space still make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max-width: 25vw;
is a magic number. We really don't need it at all so I can remove that. As far as the padding goes, I can swap this out with page-margin. I think that will work about the same and maybe be more meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mirisuzanne I think I covered all/most of your comments minus the one I had a question about (extend-small)
src/scss/patterns/_alignment.scss
Outdated
--inline-margin-right: var(--gutter); | ||
|
||
float: left; | ||
max-width: 45%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the width is old, but I am assuming that is what it was attempting on the previous site. Either that or a little less than half of the content column looked good 😄
src/scss/patterns/_media.scss
Outdated
max-width: 25vw; | ||
padding-inline: calc(var(--gutter) + 2vw); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max-width: 25vw;
is a magic number. We really don't need it at all so I can remove that. As far as the padding goes, I can swap this out with page-margin. I think that will work about the same and maybe be more meaningful.
src/scss/patterns/_alignment.scss
Outdated
.contain { | ||
display: flow-root; | ||
} | ||
|
||
[class*='align-'] { | ||
margin: var(--shim) var(--inline-margin, 0); | ||
margin: var(--shim) var(--inline-margin-right, var(--inline-margin, 0)) var(--shim) var(--inline-margin-left, var(--inline-margin, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so much easier to read when we split it out.
content/sample/images.md
Outdated
|
||
You can add the class `img-shadow` to the `embed.figure` and `embed.img` to | ||
display a shadow around the image. This doesn't work on figure if you have a | ||
caption as the shadow will be around that entire container. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an additional image for testing in both modes and upped the opacity a bit so you can see the shadow better.
Yeah, these were for testing the responsive image stuff as I was writing it - but they're probably outdated, and were never well documented. We should add a story to actually document our responsive image handling, but these don't seem useful, so I think they can just be removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great. I would still probably vote for documenting how to extend images, and how to extend-small, while also noting that it might not work in markdown. If the has()
trick even works for some browsers - it's not bad for that to be a progressive enhancement.
@mirisuzanne I updated the sample images page to include the updated guidelines for using the img/figure macros and added that little I removed the srcset examples and added a note to this existing image handling card: https://trello.com/c/p8iLneXl/117-document-responsive-image-handling-and-any-other-image-guidelines-that-arent-yet-on-the-sample-pages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!
Description
Add/edit image helpers:
<figure>
tagSteps to test/reproduce
Review a few pages that were updated:
Show me