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: Flex cards #21403

Merged
merged 27 commits into from
Dec 23, 2016
Merged

v4: Flex cards #21403

merged 27 commits into from
Dec 23, 2016

Conversation

mdo
Copy link
Member

@mdo mdo commented Dec 23, 2016

Redoes much of our cards in flexbox. Nothing huge changes here, though some card defaults have been updated. It's also worth noting that creating columns with flexbox isn't super great. I've stuck with CSS columns there for the time being, but added more vars for folks to customize,

This PR also includes the new width/height utils from #21402 so I can size columns.

Here's what's changed with cards:

  • Cards are now display: flex with flex-direction: column, though this doesn't affect the layout of the component from it's previous value, block. However, if you used .card and .card-block on the same element, you may encounter some visual bugs from the flexbox changes. To fix, separate those classes across two different HTML elements (as done in our docs).

  • Cards are still 100% by default, which is now clarified in our docs with clearer mentions of sizing and better examples across the board.

  • Cards no longer have a default bottom margin. Use spacing utilities as you need to space them out. Closes I'd like to be able to set .card margin-bottom indepedently of .card-header padding  #21073.

  • Footers in card decks and groups now align themselves to the bottom across cards thanks to some flex-grow on .card-blocks. For some card layouts, you may need to set this yourself, and to support you in that endeavor, we likely need some additional flex utilities. That'll come in future updates. Fixes .card-footer not aligned to bottom of card in .card-group #19381.

  • Revamped the card deck margins to avoid some unneeded negative margins. Unlike the grid system, which uses padding for gutters, the card deck uses margin. As such, we can conditionally remove some gutters without affecting the display of the card itself. So, now we only apply margin-left to non-:first-child cards and margin-right to non-:last-child cards. Fixes width scrolling problem with .card-deck #19883 and Make $card-deck-margin default to $grid-gutter-width-base / 2 #21300.

  • Card docs have been overhauled quite extensively to better document all the supported content types, demonstrate various layout options, better group related content, and more.

  • Card columns have been updated with new and improved variables.


Future iterations of the card component will focus on expanding layout options (horizontal mode, more/better column support, responsive decks and groups, etc). That's not being addressed here though for scope reasons.

@mdo mdo added this to the v4.0.0-alpha.6 milestone Dec 23, 2016
mdo added 3 commits December 22, 2016 18:55
- Instead of negative left/right margins, we selectively apply margins to the cards as needed. This way the first and last child never receive a left and right margin (respectively), so we don't need to negative indent those at the .card-deck level.

- Drops the margin-bottom override on the .card because there's no more default margin there.

- Drop the margin-bottom from the .card-deck to match our lack of margins on the card.

This and the previous commit fixes #19883.
@@ -21,15 +21,21 @@ The `.pos-f-t` class can be used to easily position elements at the top of the v

## Width and height

Easily make an element as wide or as tall as its parent using the `.w-100` and `.h-100` utility classes.
Easily make an element as wide or as tall (relative to its parent) our width and height utilities. Includes support for `25%`, `50%`, `75%`, and `100%`.

Choose a reason for hiding this comment

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

Should be a 'with' before the 'our'.

@@ -389,7 +381,7 @@ module.exports = function (grunt) {

// Docs task.
grunt.registerTask('docs-css', ['cssmin:docs', 'exec:postcss-docs']);
grunt.registerTask('lint-docs-css', ['scsslint:docs']);
grunt.registerTask('lint-docs-css', ['exec:scss-lint-docs']);

Choose a reason for hiding this comment

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

Extra semicolon semi

@mdo
Copy link
Member Author

mdo commented Dec 23, 2016

Woof, I fucked up this PR history somehow. Going to merge manually. 😫

@mdo mdo merged commit 4b62a93 into v4-dev Dec 23, 2016
@bardiharborow bardiharborow deleted the flex-cards branch February 1, 2017 08:40
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.

3 participants