-
Notifications
You must be signed in to change notification settings - Fork 145
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
Feature/img modal #283
Feature/img modal #283
Conversation
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.
Hey @xvandish,
Thanks a ton for the contribution! This is a fantastic addition.
I appreciate the care you put in in for conditionally adding the html for the modal only if there's an image tag present, but I think we can probably include the modal HTML in the ejs for the article page by default and ditch the ssrComponent folder. Having it always in the HTML will simplify things quite a bit.
very welcome! |
Co-authored-by: Andrew Fischer <afischer@users.noreply.github.com>
@afischer - making the changes rn, this is the current structure
Pros:
Cons
What do you think about having everything be done on the client-side? |
@afischer - pure client side impl made, still very fast, whole thing takes abt ~1ms after dom load. let me know what you think! |
I think that 1ms is likely fine! It would probably take just as long for the event handlers to bind client-side anyway, plus I don't think people are quite that fast when interacting with paged 😄 |
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.
[We spoke about this offline but posting here for posterity]
This looks awesome, just one small thing: it seems like since the code for the modal is inlined in the footer, it's causing a TypeError
on the homepage. If we could either add a more tightly scoped check or refactor this a bit to only appear on "category"/article pages (bad name, I know!) this should be good to merge!
This is also another good case for consideration when working on #53. Might add a note there about thinking about inlined client-side code.
good catch! I can think of two ways rn
Although, if we go with 1 - we've now split <script> tags to 3 different places, which could get gnarly. I also gave whats currently in My suggestion would be option 2 - leave it in footer and check hostname before initializing - and I can open a separate PR to shift the other scripts down to footer as well to address #53. What do you think? |
2 seems like an easy and effective fix! A third option, which might be the cleanest, could be to pull the HTML content from |
ed4f852
to
446213a
Compare
446213a
to
2c9ea2a
Compare
Thats an even better idea! I've made that change, and there's now a |
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.
Awesome, thanks so much for implementing this and for the quick work! Looking forward to getting this into our next release!
Description of Change
This PR adds an image modal/dialog that allows images to be clicked on and expanded within the modal. Style and functionality is similar to the NYT image expansion modal like the one here. I got permission from the internal team for use of the svgs for expand/collapse since copied straight from the NYT image modal.
Features:
svgo
Here's a preview
Related Issue
#268
Motivation and Context
At the moment, all images are constrained to a max-width of ~560px. This makes some high-res images difficult to read. Allowing an image modal makes some images easer to see.
Checklist
npm run lint
and updated code style accordinglynpm run test
passesI'll clean up the commit history once any issues have been worked through.