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(card): Add theme mixins; remove content layouts #2025

Merged
merged 74 commits into from
Jan 26, 2018
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
f9e256f
chore(card): Remove layouts (WIP)
acdvorak Jan 18, 2018
d7c537f
WIP: Add __action-buttons and __action-icons classes
acdvorak Jan 18, 2018
1cbe378
WIP: Refactoring
acdvorak Jan 18, 2018
d3bace3
WIP: Add __media classes, rename other classes
acdvorak Jan 18, 2018
51fa44d
WIP: Rename classes
acdvorak Jan 18, 2018
d363411
WIP: Refactoring and add "Share" action icon
acdvorak Jan 18, 2018
4c08741
feat(base): shouldBubble now defaults to `true`
acdvorak Jan 19, 2018
aac2ca2
WIP: Spec alignment
acdvorak Jan 19, 2018
3604c49
WIP: Add example of a "small" card
acdvorak Jan 19, 2018
da234a4
WIP: Add music album example
acdvorak Jan 19, 2018
059a325
WIP: Rename class, reorder styles
acdvorak Jan 19, 2018
b6a5993
WIP: Add margin between buttons and icons
acdvorak Jan 19, 2018
e27c1c1
WIP: Start updating README
acdvorak Jan 19, 2018
e41ddbf
Merge branch 'master' into chore/card/remove-layouts
acdvorak Jan 20, 2018
bb574cc
WIP: Update cards on theme demo page
acdvorak Jan 20, 2018
0bcb922
WIP: Fix example card background colors
acdvorak Jan 20, 2018
aeaa446
WIP: Add mixins; refactor
acdvorak Jan 20, 2018
482dbe8
WIP: Update README
acdvorak Jan 20, 2018
06c0920
WIP: Set elevation color automatically
acdvorak Jan 20, 2018
1750a9f
WIP: Removed unused CSS class
acdvorak Jan 20, 2018
c9b6278
Revert "feat(base): shouldBubble now defaults to `true`"
acdvorak Jan 20, 2018
86f2083
Merge remote-tracking branch 'origin/master' into chore/card/remove-l…
acdvorak Jan 22, 2018
6fb8e12
WIP: __media inherits border-radius from card; add radius mixin
acdvorak Jan 22, 2018
0cb61b0
WIP: Remove mdc-card-corner-radius mixin
acdvorak Jan 23, 2018
4bbfd02
Revert "WIP: Remove mdc-card-corner-radius mixin"
acdvorak Jan 23, 2018
dc4c5c3
WIP: Rename `__action-bar` to `__actions` for backward compatibility
acdvorak Jan 23, 2018
6f4acb8
WIP: Reorder mixins
acdvorak Jan 23, 2018
6836c5e
Merge remote-tracking branch 'origin/master' into chore/card/remove-l…
acdvorak Jan 23, 2018
1f32dcd
WIP: Don't override elevation color
acdvorak Jan 23, 2018
974edd6
Merge remote-tracking branch 'origin/master' into chore/card/remove-l…
acdvorak Jan 24, 2018
8ce2bac
WIP: Minor cleanup
acdvorak Jan 24, 2018
5a72bf1
Merge branch 'master' into chore/card/remove-layouts
acdvorak Jan 24, 2018
6c5970f
WIP: Fix ripple overflow bug in IE 11 and Edge on demo page
acdvorak Jan 24, 2018
dafbd04
WIP: Don't wrap icons in mdc-button
acdvorak Jan 24, 2018
8f0db4d
WIP: Use # and preventDefault instead of "javascript:" links
acdvorak Jan 24, 2018
9fdced1
WIP: Don't use event delegation for a single element
acdvorak Jan 24, 2018
45e98de
WIP: Remove TODO
acdvorak Jan 24, 2018
414c981
WIP: Replace javascript: with # in readme example
acdvorak Jan 24, 2018
87980a4
WIP: Clarify that `mdc-card` is mandatory
acdvorak Jan 24, 2018
c0f4e51
WIP: Rename mixin params
acdvorak Jan 24, 2018
b7627db
WIP: Rewording
acdvorak Jan 24, 2018
49469c0
WIP: Refactoring
acdvorak Jan 24, 2018
24b794b
WIP: Fix button margins
acdvorak Jan 25, 2018
fa9073b
WIP: Add __action--button class to avoid violating BEM
acdvorak Jan 25, 2018
420a1ec
WIP: Fix action button margins
acdvorak Jan 25, 2018
ff57974
WIP: Remove unnecessary <span> element and use correct aria attr
acdvorak Jan 25, 2018
f4731c1
WIP: Semantic HTML: Use <div> instead of <section> for card areas
acdvorak Jan 25, 2018
70e7c49
WIP: Always use mdc-card__action--button class on buttons
acdvorak Jan 25, 2018
3364d96
WIP: Update wording in README
acdvorak Jan 25, 2018
75f81dc
WIP: Simplify example in README
acdvorak Jan 25, 2018
137b74d
WIP: Clean up README
acdvorak Jan 25, 2018
7c0f775
WIP: Set `box-sizing: border-box` and `display: flex` on all elements
acdvorak Jan 25, 2018
51de056
WIP: Set `color` explicitly on `__action--icon` rather than inheritin…
acdvorak Jan 25, 2018
689290d
WIP: Use <div> instead of <section>
acdvorak Jan 25, 2018
1503a2f
WIP: Simplify icon-only action row example
acdvorak Jan 25, 2018
90840cf
WIP: Refactor `align-items: center` into `mdc-card-row-layout_` mixin
acdvorak Jan 25, 2018
0a81243
Merge remote-tracking branch 'origin/master' into chore/card/remove-l…
acdvorak Jan 25, 2018
3c5f572
WIP: Reorder ready.js import in <head>
acdvorak Jan 25, 2018
fc36930
WIP: Remove preventDefault for dummy links
acdvorak Jan 25, 2018
f177ce0
WIP: Import common.js
acdvorak Jan 25, 2018
25a70ca
WIP: Update theme demo page markup
acdvorak Jan 25, 2018
3a74182
WIP: Simplify theme demo page example
acdvorak Jan 25, 2018
d26281d
Merge remote-tracking branch 'origin/master' into chore/card/remove-l…
acdvorak Jan 25, 2018
8e24e56
WIP: Add `user-select: none` to `mdc-card__action`
acdvorak Jan 25, 2018
cf07755
WIP: Use padding instead of margin on __action--icon
acdvorak Jan 25, 2018
4ed5f6a
WIP: Fix import and remove unneeded class
acdvorak Jan 25, 2018
d36e518
WIP: Fix action bar height by applying negative margin to all __actio…
acdvorak Jan 25, 2018
8f000b6
WIP: Show custom corner radius; rename demo classes
acdvorak Jan 26, 2018
02d4e85
WIP: Right-justify icons in photo card example
acdvorak Jan 26, 2018
f1e773d
WIP: Fix RTL corner radius in demo page
acdvorak Jan 26, 2018
7da8ad4
Merge remote-tracking branch 'origin/master' into chore/card/remove-l…
acdvorak Jan 26, 2018
36f93b8
WIP: Remove unnecessary mixin
acdvorak Jan 26, 2018
67be91a
WIP: Don't bother setting box-sizing on pseudo elements
acdvorak Jan 26, 2018
52e13ed
Merge branch 'master' into chore/card/remove-layouts
acdvorak Jan 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
457 changes: 191 additions & 266 deletions demos/card.html

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions demos/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,167 @@
@import "../packages/mdc-card/mdc-card";
@import "../packages/mdc-checkbox/mdc-checkbox";
@import "../packages/mdc-form-field/mdc-form-field";
@import "../packages/mdc-icon-toggle/mdc-icon-toggle";
@import "../packages/mdc-list/mdc-list";
@import "../packages/mdc-ripple/mixins";

.hero {
height: auto;
padding: 24px;
}

.demo-card-collection {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: center;
padding: 0 24px;
}

.demo-card-toggles {
margin: 24px;
padding: 24px;
text-align: center;
}

//
// Card container
//

.demo-card {
width: 350px;
margin: 48px;
}

.demo-card--photo-album {
width: 200px;
}

//
// Images
//

.demo-card__media {
background-image: url("/images/1-1.jpg");
}

.demo-card__media--16-9 {
background-image: url("/images/16-9.jpg");
}

.demo-card__media-content--with-title {
display: flex;
flex-direction: column;
justify-content: flex-end;
}

.demo-card__media-title {
padding: 8px 16px;
background-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.5) 100%);
color: white;
}

//
// Focusable child elements
//

.demo-card__ripple-surface {
@include mdc-ripple-surface;
@include mdc-ripple-radius;
@include mdc-states;

&:not([data-mdc-ripple-is-unbounded]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to just apply these styles to .demo-card-article instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially, but if we ever decide to add another card example that uses
demo-card__ripple-surface on a different element, it won't get the benefit of the
IE/Edge workaround (position: relative).

position: relative; // IE and Edge ignore `overflow: hidden` if the element is positioned statically
overflow: hidden;
}

&:focus {
outline: none;
}
}

//
// Book card
//

.demo-card__primary {
padding: 1rem;
}

.demo-card__title {
margin: 0;
}

.demo-card__subtitle {
@include mdc-theme-prop(color, text-secondary-on-background);

margin: 0;
}

.demo-card__secondary {
@include mdc-theme-prop(color, text-secondary-on-background);

padding: 0 1rem 8px 1rem;
}

//
// Headlines card
//

.demo-card-article-group-heading {
@include mdc-theme-prop(color, text-secondary-on-light);

padding: 8px 16px;
}

.demo-card-article {
padding: 16px;
text-decoration: none;
color: inherit;
}

.demo-card-article__title {
margin: 0 0 4px 0;
}

.demo-card-article__snippet {
@include mdc-theme-prop(color, text-secondary-on-light);

margin: 0;
}

//
// Photo card
//

.demo-card__actions--centered {
justify-content: center;
}

//
// Music card
//

.demo-card__music-row {
display: flex;
}

.demo-card__media--music {
width: 110px;
}

.demo-card__music-info {
display: flex;
flex-direction: column;
padding: 8px 16px;
}

.demo-card__action-buttons--text-only {
margin-left: 8px;
}

.demo-card__action-icon--star {
margin-left: 4px;
margin-right: 4px;
cursor: pointer;
}
25 changes: 4 additions & 21 deletions demos/theme/_theme-shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -264,33 +264,16 @@ figure {

.demo-card-wrapper {
display: inline-block;
width: 350px;
margin: 0 24px 24px 0;
vertical-align: top;
}

.demo-card--with-avatar .mdc-card__primary {
position: relative;
}

.demo-card--with-avatar .demo-card__avatar {
position: absolute;
width: 2.5rem; // 40sp
height: 2.5rem; // 40sp
border-radius: 50%;
background: #bdbdbd;
}

.demo-card--with-avatar .mdc-card__title,
.demo-card--with-avatar .mdc-card__subtitle {
margin-left: 56px;
.demo-card__media {
background-image: url("/images/1-1.jpg");
}

.demo-card--small .mdc-card__media {
height: 10.938rem; // 175sp, for 1:1 ratio with 175sp demo card width
background-image: url(/images/1-1.jpg);
background-repeat: no-repeat;
background-size: cover;
.demo-card__media--16-9 {
background-image: url("/images/16-9.jpg");
}

//
Expand Down
69 changes: 29 additions & 40 deletions demos/theme/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -360,46 +360,35 @@ <h3 class="mdc-typography--headline demo-component-section__heading">

<div class="demo-card-wrapper">
<div class="mdc-card">
<section class="mdc-card__primary">
<h1 class="mdc-card__title mdc-card__title--large">Title goes here</h1>
<h3 class="mdc-card__subtitle">Subtitle here</h3>
</section>
<section class="mdc-card__supporting-text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</section>
<section class="mdc-card__actions">
<button class="mdc-button mdc-button--compact mdc-card__action">Action 1</button>
<button class="mdc-button mdc-button--compact mdc-card__action">Action 2</button>
</section>
</div>
</div>

<div class="demo-card-wrapper">
<div class="mdc-card demo-card--with-avatar">
<section class="mdc-card__primary">
<div class="demo-card__avatar"></div>
<h1 class="mdc-card__title">Title</h1>
<h3 class="mdc-card__subtitle">Subhead</h3>
</section>
<section class="mdc-card__supporting-text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.
</section>
<section class="mdc-card__actions">
<button class="mdc-button mdc-button--compact mdc-card__action">Action 1</button>
<button class="mdc-button mdc-button--compact mdc-card__action">Action 2</button>
</section>
</div>
</div>

<div class="demo-card-wrapper">
<div class="mdc-card demo-card--small">
<section class="mdc-card__media">
<h1 class="mdc-card__title mdc-card__title--large">Title</h1>
</section>
<section class="mdc-card__actions">
<button class="mdc-button mdc-button--compact mdc-card__action">Action 1</button>
</section>
<div class="mdc-card__media mdc-card__media--16-9 demo-card__media"></div>
<div class="mdc-card__actions">
<div class="mdc-card__action-buttons">
<button class="mdc-button mdc-card__action mdc-card__action--button">Read</button>
<button class="mdc-button mdc-card__action mdc-card__action--button">Bookmark</button>
</div>
<div class="mdc-card__action-icons">
<i class="mdc-icon-toggle material-icons mdc-card__action mdc-card__action--icon"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here as above RE unbounded/bounded ripples next to each other

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

tabindex="0"
role="button"
aria-pressed="false"
aria-label="Add to favorites"
title="Add to favorites"
data-toggle-on='{"content": "favorite", "label": "Remove from favorites"}'
data-toggle-off='{"content": "favorite_border", "label": "Add to favorites"}'>
favorite_border
</i>
<i class="material-icons mdc-card__action mdc-card__action--icon mdc-ripple-surface"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do something to make the padding of these consistent with the icon-toggle? They currently mismatch (and I'm fixing the unbounded ripple size in #2092 which will make the icon-toggle ripple the correct size).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

tabindex="0"
role="button"
data-mdc-ripple-is-unbounded
title="Share">share</i>
<i class="material-icons mdc-card__action mdc-card__action--icon mdc-ripple-surface"
tabindex="0"
role="button"
data-mdc-ripple-is-unbounded
title="More options">more_vert</i>
</div>
</div>
</div>
</div>
</section>
Expand Down
Loading