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

feat(carousel): Allow to hide navigation items if only one slide #2275

Closed

Conversation

wilhelmhb
Copy link

@wilhelmhb wilhelmhb commented Mar 31, 2018

Closes #2274

@wilhelmhb
Copy link
Author

The tests seems to fail only due to Microsoft Edge and nbg-datepicker.
I can't test on the first one, and haven't touched the second.
@pkozlowski-opensource: do you have any hint as to where the issue could be ?

@@ -183,6 +195,10 @@ export class NgbCarousel implements AfterContentChecked,
}
}

showNavigation(): boolean { return !this.hideNavigation || (this.slides != null && this.slides.length > 1); }

Choose a reason for hiding this comment

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

@wilhelmhb could you please remove the this.slides.length > 1 check (and the corresponding tests(s) based on #2274 (comment) ?

Copy link
Author

Choose a reason for hiding this comment

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

If I remove the this.slides.length > 1 check, then the navigation items will be hidden, no matter how many slides you have.
If you have several slides, IMHO, it would never make sense to hide these navigations items. Hence the check.

@@ -183,6 +195,10 @@ export class NgbCarousel implements AfterContentChecked,
}
}

showNavigation(): boolean { return !this.hideNavigation || (this.slides != null && this.slides.length > 1); }

showIndicator(): boolean { return !this.hideIndicator || (this.slides != null && this.slides.length > 1); }

Choose a reason for hiding this comment

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

@wilhelmhb could you please remove the this.slides.length > 1 check (and the corresponding tests(s) based on #2274 (comment) ?

Copy link
Author

Choose a reason for hiding this comment

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

if we have more than one slide, we probably still want to display the navigation item, right ?
Otherwise the user won't see that he/she can slide through the several slides.

@pkozlowski-opensource
Copy link
Member

@wilhelmhb it looks good to me, generally speaking, could you just please:

Thnx!

@wilhelmhb
Copy link
Author

wilhelmhb commented Apr 29, 2018

As navigation items are required when there are several slides, the explicit check on one slide is needed.
My branch has been rebased and all tests have passed.

@pkozlowski-opensource
Copy link
Member

As navigation items are required when there are several slides

Why? Slides still change with time interval so I can imagine people wanting to have a carousel without navigation, even if there are multiple slides.

the explicit check on one slide is needed.

I don't think I see why. Once again, I believe that an explicit flag to disable navigation (regardless of number of slides) would be enough (and less confusing at the same time).

@wilhelmhb
Copy link
Author

I get what you mean, I'll change it ASAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants