Skip to content

Add card molecule (Fixes #71)#103

Merged
craigcook merged 2 commits intomozilla:masterfrom
alexgibson:card-molecule
May 10, 2018
Merged

Add card molecule (Fixes #71)#103
craigcook merged 2 commits intomozilla:masterfrom
alexgibson:card-molecule

Conversation

@alexgibson
Copy link
Copy Markdown
Contributor

@alexgibson alexgibson commented May 9, 2018

Description

  • Add a card molecule class with 4 variations:
    • Large Card
    • Medium Card
    • Card
    • Extra Small Card
  • Adds a card layout class template with 4 variations
    • 5 Card Hero Layout
    • 4 Card Layout
    • 3 Card Layout
    • 2 Card Layout
  • Adds a demo page showing different card type and layout combinations.

Demo links

@alexgibson alexgibson requested a review from craigcook May 9, 2018 15:52
@alexgibson alexgibson added the Do Not Merge ⚠️ Do Not Merge label May 9, 2018
@alexgibson
Copy link
Copy Markdown
Contributor Author

/cc @vincejoyiv

@alexgibson
Copy link
Copy Markdown
Contributor Author

Ok rebased, this should now be ready for review / merge.

@alexgibson alexgibson removed the Do Not Merge ⚠️ Do Not Merge label May 9, 2018
@craigcook craigcook self-assigned this May 10, 2018
Copy link
Copy Markdown
Contributor

@craigcook craigcook left a comment

Choose a reason for hiding this comment

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

This is so awesome! 😁 Just a few places where I think we can use the bidi mixin, plus one typo.

Not a blocker for this PR but since most of the examples repeat the same markup just with different classes, we could build a single include and pass those classes in. See https://github.com/cloudfour/drizzle/tree/master/src/patterns/components/button for examples.

You can also use the same include/embed method in demos: https://github.com/mozilla/protocol/blob/master/src/pages/demos/article.hbs#L15 But we can merge this now and convert it into variant embeds another time.


// Preserve aspect ratio to prevent content jumping when media loads.
// Apply to a direct parent element of an image or video.
@mixin aspect-ratio($width, $height, $width-wrapper: 100%) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

😎

// On small screens cards stack vertically and span full container width.
// On medium sized screens cards span half width.
// On large screens cards span quater widths.
.mzp-l-card-quater {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo: quater -> quarter


&:nth-child(2),
&:last-child {
margin-right: 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you can use the bidi mixin here as well. @include bidi(((margin-right, 0, margin-left, 0),));

If I understand, the mixin behaves a little differently when there are four values instead of three: https://github.com/mozilla/protocol/blob/master/src/assets/sass/protocol/includes/mixins/_bidi.scss#L20

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah! i struggled with this and didn't grok the extra value. Thanks for the pointer 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure I fully grok it either... I swiped that mixin from MDN. It almost seems to be doing too much. I wonder if it could be simplified.

}

&:nth-child(4n) {
margin-right: 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another place where I think the mixin should work with four values: @include bidi(((margin-right, 0, margin-left, 0),));

}

&:nth-child(3n) {
margin-right: 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@include bidi(((margin-right, 0, margin-left, 0),));

@alexgibson
Copy link
Copy Markdown
Contributor Author

alexgibson commented May 10, 2018

@craigcook thanks for the review (and pointers on the bidi mixin!). I added a commit with some fixes.

I think using a macro on the card examples is a great suggestion (will add a post-merge task to tidy this up later)

@craigcook craigcook merged commit 6b00a7c into mozilla:master May 10, 2018
@alexgibson alexgibson deleted the card-molecule branch May 10, 2018 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants