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

Don't show nav or gallery controls if there is only one lightboxed image #15475

Merged
merged 1 commit into from May 23, 2018

Conversation

cathyxz
Copy link
Contributor

@cathyxz cathyxz commented May 21, 2018

Closes #15198, since <amp-lightbox-gallery> is now launched, and this covers the single-image usecase.

@cathyxz cathyxz force-pushed the feature/lightbox-one-item branch 2 times, most recently from 4449dff to ddf80c2 Compare May 22, 2018 17:42
@cathyxz
Copy link
Contributor Author

cathyxz commented May 22, 2018

Rebasing for bundle size flake.

@cathyxz cathyxz force-pushed the feature/lightbox-one-item branch from ddf80c2 to 748ea8d Compare May 22, 2018 23:28
@ghost
Copy link

ghost commented May 22, 2018

This pull request introduces 1 alert when merging 748ea8d into d175fb8 - view on lgtm.com

new alerts:

  • 1 for Syntax error

Comment posted by lgtm.com

*/
toggleNavControls_(noOfChildren) {
if (noOfChildren > 1) {
this.controlsContainer_.classList.remove('i-amphtml-lbg-single');
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You can use classList.toggle e.g.

this.controlsContainer_.classList.toggle('i-amphtml-lbg-single', noOfChildren <= 1);

Copy link
Contributor

Choose a reason for hiding this comment

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

super optional nit: childCount is easier to read since it doesn't use an abbreviation

Copy link
Contributor

@cvializ cvializ May 23, 2018

Choose a reason for hiding this comment

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

Do you plan to use the CSS class i-amphtml-lbg-single for other purposes? If not, you can toggle the internal class i-amphtml-hidden that AMP already uses to hide elements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh excellent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh... hmm. I'll need to toggle it for three elements I guess.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's true, that could introduce complexity. I'm fine with the CSS how it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI I just checked though. We don't actually have an i-amphtml-hidden css class. We have an amp-hidden class. It doesn't have default behavior, but each component defines behavior for it separately...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I grepped too quickly!

Copy link
Contributor

@cvializ cvializ left a comment

Choose a reason for hiding this comment

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

LGTM

@cathyxz cathyxz merged commit 22c46ed into ampproject:master May 23, 2018
@cathyxz cathyxz deleted the feature/lightbox-one-item branch December 5, 2018 00:11
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.

None yet

3 participants