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

v4: Flexbox carousel options #21400

Merged
merged 5 commits into from
Dec 22, 2016
Merged

v4: Flexbox carousel options #21400

merged 5 commits into from
Dec 22, 2016

Conversation

mdo
Copy link
Member

@mdo mdo commented Dec 22, 2016

Following up on #21389, this implements flexbox into some aspects of the carousel. The entire thing isn't flexbox (yet?) as I think that might require a rethinking of the JS approach. (Compare our JS methods to https://blog.madewithenvy.com/the-order-property-flexbox-carousels-87a168567820#.7vubbda6s, for example.)

However, this does make the following changes:

  • Sets display: flex instead of block on active carousel items. There's no visual different here, but if folks want to get creative, this might make it a bit easier.

  • Rebuilds carousel controls (the left and right click areas) with flexbox. They're still absolutely positioned themselves, but the icons within are now aligned via flexbox. Far simpler styling overall.

  • Rebuilds carousel indicators with flexbox. Instead of a fixed width, we're now using a max-width and some flexbox styling to scale to n number of indicators quite easily. This required adding some new horizontal margin (display: flex doesn't "suffer" from the same HTML space as inline-block); I've added a new variable to help customize that here.

  • Removed some unused CSS that was left in since the move back to SVGs for icons and more.

Fixes #21305.

mdo added 4 commits December 22, 2016 14:30
This revamps the indicators to use flexbox instead of inline-block for added flexbility (hah). Indicators now automatically scale based on the number of elements present, and max out at the `$carousel-indicator-width` instead of always being that wide.
- Drops the absolute positioning of the icons within the left/right controls. We have to keep the controls themselves positioned though since we're overlapping HTML elements here.

- No more position, left, right, or margins involved; just some justify-content and align-items.

- Add some comments for explaining which flex property-value pair does what.

- Remove the unapplied font and line-height stuff now that we're all SVGs and flexbox here.
@mdo mdo added this to the v4.0.0-alpha.6 milestone Dec 22, 2016
@@ -61,6 +61,10 @@
position: absolute;
top: 0;
bottom: 0;
// Use flex for alignment (1-3)
display: flex; // 1. allow flex styles
justify-content: center; // 2. horizontally center contents

Choose a reason for hiding this comment

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

Properties should be ordered position, top, bottom, display, align-items, justify-content, width, color, text-align, opacity

@mdo mdo merged commit 736be8f into v4-dev Dec 22, 2016
@mdo mdo deleted the flex-carousel branch December 22, 2016 22:58
@mdo mdo mentioned this pull request Dec 22, 2016
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.

2 participants