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

Refactor carousel #21298

Merged
merged 32 commits into from
Dec 6, 2016
Merged

Refactor carousel #21298

merged 32 commits into from
Dec 6, 2016

Conversation

mdo
Copy link
Member

@mdo mdo commented Dec 5, 2016

screen shot 2016-12-04 at 11 06 58 pm

This PR refactors the carousel to un-nest CSS selectors, simplify overall styling, and improve documentation of key features. More specifically:

  • New visuals for a simpler design. I've removed the gradients on the controls, changed the indicators from circles to squares (with larger tap areas), and added new icons.

  • Un-nest CSS. Instead of .carousel > .item and the like, we have .carousel-* prefixed on all classes (save for the .active state). This includes the slides, controls, and indicators. Fixes Consider clarifying some of the carousel classes (right, left, icon-*) #18396.

  • Simply CSS for sliding effects. We added transforms later in v3's lifecycle, so we had to support transitions for position and transform. No more; now we just have 3D transforms, so our compiled CSS is much simpler.

  • More reliance on utilities. Image styles for within carousel items have been removed, so now you'll need to use utilities or custom styles (e.g., .d-block and .img-fluid). Similarly, I've included an example of responsive captions in our docs built with utilities.

  • Improved documentation. The original example is now split across a handful of examples, each building on the previous (from slides only, to controls, to indicators, to captions). Rewrites some of the intro docs and also provides better guidance on responsive captions and more.

  • Tweak JS to better handle directional states. This pulls in the JS changes from Add prefix to carousel classes #18830 to accomplish that.

  • Fixes left carousel-control and right carousel-control elements are not visible in the carousel example #17878, correcting the Carousel example.

  • Update migration docs to mention changes.

mdo added 12 commits November 25, 2016 23:42
- Un-nests .carousel-item
- Appends .carousel-item- to .left, .right, .next, and .prev
- Chain .carousel-item to .active where approproriate
- fix naming of left/right controls
- drop the absolute positioning of things and rely on only 3d transforms
- remove img styles and require classes to avoid inline-block line-height stuff
@mdo mdo added this to the v4.0.0-alpha.6 milestone Dec 5, 2016
padding-left: 0;
margin-left: -($carousel-indicators-width / 2);
// Use the .carousel-control's width as margin so we don't overlay those
margin-right: $carousel-control-width;

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, right, bottom, left, z-index, padding-left, margin-right, margin-left, text-align, list-style

@mdo
Copy link
Member Author

mdo commented Dec 5, 2016

Pushed a ton more updates to this since opening the PR. The only remaining thing this doesn't address yet is a flexbox variant. I'll tackle that tomorrow I think. Things that might benefit from flexbox:

  • Control-caption dimensions staying in sync
  • Control icon alignment
  • Indicator alignment

Some of this likely can be done with utilities, too.

@ghiscoding
Copy link

Hello, I was briefly looking at the code change and just happened to find a small typo in the migration.md file at line 190. The new text in the PR has duplicate .carousel-control-left as shown below

For prev/next controls, `.carousel-control.right` and `.carousel-control.left` 
are now `.carousel-control-left` and `.carousel-control-left`, 
meaning they no longer require a specific base class.

Thanks for this great framework :)

@mdo mdo merged commit ede925d into v4-dev Dec 6, 2016
@mdo mdo deleted the carousel branch December 6, 2016 07:31
@mdo
Copy link
Member Author

mdo commented Dec 6, 2016

Punting flexbox variant to another PR. Opened #21305 to track.

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.

3 participants