-
Notifications
You must be signed in to change notification settings - Fork 561
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
Es6 projects common modules gallery lightbox #18113
Es6 projects common modules gallery lightbox #18113
Conversation
PRbuilds results: Screenshots 💚 Exceptions 💚 A11y validation Apache Benchmark Load Testing 💚 Microdata Validation --automated message |
00bc5ad
to
5d3e0ac
Compare
Wow, this one is a monster! Awesome work 🎉 As a general suggestion, how do you feel about adding return type annotations to the methods of the |
this.endslate.endpoint = '/gallery/most-viewed.json'; | ||
this.endslate.prerender = function () { | ||
bonzo(this.elem).addClass(this.componentClass); | ||
}; |
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.
Is the prerender
functionality longer needed?
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.
Yes! Not sure how I lost it. I brought it back though :)
}); | ||
}; | ||
|
||
export { init, GalleryLightbox }; |
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.
GalleryLightbox
doesn't appear to be imported anywhere. Can we remove it from the export
object?
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.
It is used in the tests, so I followed the advice in the wiki to export it differently
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.
Oha, this module is painful. Thanks for picking it up! 👍
}; | ||
|
||
const galleryLightboxHtml: string = | ||
`${'<div class="overlay gallery-lightbox gallery-lightbox--closed gallery-lightbox--hover">' + |
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.
Since this a template literal you don't have to use concatenation and just use it as a multiline string.
// FSM CONFIG | ||
this.fsm = new FiniteStateMachine({ | ||
initial: 'closed', | ||
onChangeState(oldState, newState) { |
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.
Types? 👍
|
||
generateImgHTML(img: Object, i: number) { | ||
const blockShortUrl = config.get('page.shortUrl'); | ||
const urlPrefix = img.src.indexOf('//') === 0 ? 'http:' : ''; |
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.
img.src.startsWith('//') ? 'http:' : '';
contentEl.style.mozTransform = `translate(${px + offset}px,0)`; | ||
contentEl.style.msTransform = `translate(${px + offset}px,0)`; | ||
contentEl.style.transform = `translate(${px + | ||
offset}px,0) translateZ(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.
Does flow complain of you do
Object.assign(contentEl.style, {
/* ... */
})
to avoid all the repetition?
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.
It does not! Great suggestions 👍
} else if (e.keyCode === 73) { | ||
// 'i' | ||
this.trigger('toggleInfo'); | ||
} |
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.
🤦♀️
|
||
let res; | ||
|
||
bean.on(document.body, 'click', '.js-gallerythumbs', e => { |
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.
Because the callback is so big: could you add the :Event
type definition here?
} | ||
} | ||
|
||
GalleryLightbox.prototype.states = { |
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.
Could you move all of these into the constructor()
?
}, | ||
loadJson(json: GalleryJson) { | ||
this.galleryJson = json; | ||
this.images = json.images ? json.images : []; |
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.
this.images = json.images || [];
Thanks so much!
Maybe this will finally fix #6144? Bravo! 🎆
Hmm, don't know anything about that, works for me (desktop, mobile).
Not counting the enhancements. And not counting the ones not recorded as issues (broken zoom, do-not-dare-swiping-up-on-Android-only-pros-know-how-to-not-have-addressbar-shown, lack of FullscreenAPI, close button not automatically appearing on last item, long captions breaking experience, not appearing for liveblog images, shut-up-paperboyo and many more 😆). And integrating this for (for starters) disconnected members of a series 😉. |
83ae618
to
ebd4e7b
Compare
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.
LATM 👍
Seen on PROD (merged by @NataliaLKB 21 minutes and 48 seconds ago)
|
What does this change?
ES6 conversion for lightbox.js. I tried my best not to rewrite, but just convert (as advised)
This is my first es6 conversion so please let me know everything I could do better :).
Please note, I know of 3 current production bugs in lightbox. They are:
What is the value of this and can you measure success?
More modern JS
Does this affect other platforms - Amp, Apps, etc?
Nope
Does this affect GLabs Paid Content Pages? Should it have support for Paid Content?
Nope
Screenshots
Everything looks the same
Tested in CODE?
Yes