Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit aad3d5b

Browse files
authored
feat(card): Improvements (#1352)
- Inject `MdcRipple` into `mdc-card-primary-action` automatically - Converted `mdc-card-primary-action` to a component selector - Removed `icons: boolean` from `mdc-card-actions` - Removed `buttons: boolean` from `mdc-card-actions` - Converted `@HostBindings` to directive configuration - Cleaned up documentation and examples - Improved unit test coverage BREAKING CHANGES: - `MdcRipple` is now automatically injected into `mdc-card-primary-action`, just remove any previous `mdc-ripple` directives applied. - Removed `icons: boolean` from `mdc-card-actions`. Please update your code to use `mdc-card-action-icons`. - Removed `buttons: boolean` from `mdc-card-actions`. Please update your code to use `mdc-card-action-buttons`.
1 parent fdb90ec commit aad3d5b

File tree

8 files changed

+115
-107
lines changed

8 files changed

+115
-107
lines changed

demos/components/card-demo/card-demo.html

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,6 @@ <h2>Design & API Documentation</h2>
101101
<td>fullBleed: boolean</td>
102102
<td>Removes the action area's padding and causes its only child (an mdc-card__action element) to consume 100% of the action area's width.</td>
103103
</tr>
104-
<tr>
105-
<td>icons: boolean</td>
106-
<td>A group of supplemental action icons, displayed on the right side of the card (in LTR), adjacent to mdc-card-action buttons</td>
107-
</tr>
108-
<tr>
109-
<td>buttons: boolean</td>
110-
<td>A group of action buttons, displayed on the left side of the card (in LTR), adjacent to mdc-card-action icons</td>
111-
</tr>
112104
</tbody>
113105
</table>
114106

@@ -149,7 +141,7 @@ <h2>Design & API Documentation</h2>
149141
</tr>
150142
<tr>
151143
<td>
152-
<span mdcSubtitle2>Example: mdcCardAction="icon" or mdcCardAction="button"</span>
144+
<span mdcSubtitle2>Usage: mdcCardAction="icon" or mdcCardAction="button"</span>
153145
</td>
154146
</tr>
155147
</tbody>
@@ -166,8 +158,8 @@ <h2>Basic Usage</h2>
166158
</div>
167159

168160
<mdc-card class="demo-card">
169-
<mdc-card-primary-action mdc-ripple>
170-
<mdc-card-media class="demo-card__media--16-9" [wide]="true"></mdc-card-media>
161+
<mdc-card-primary-action>
162+
<mdc-card-media class="demo-card__media--16-9" wide></mdc-card-media>
171163
<div class="demo-card__primary">
172164
<h2 class="demo-card__title" mdcHeadline6>Our Changing Planet</h2>
173165
<h3 class="demo-card__subtitle" mdcSubtitle2>by Kurt Wagner</h3>
@@ -192,7 +184,7 @@ <h3 class="demo-card__subtitle" mdcSubtitle2>by Kurt Wagner</h3>
192184
</mdc-card-actions>
193185
</mdc-card>
194186

195-
<mdc-card [outlined]="true" class="demo-card">
187+
<mdc-card class="demo-card" outlined>
196188
<div class="demo-card-article-group-heading" mdcSubtitle2>Headlines</div>
197189
<mdc-list-divider></mdc-list-divider>
198190
<mdc-ripple class="demo-card-article">
@@ -216,7 +208,7 @@ <h2 class="demo-card-article__title" mdcHeadline5>Asia's clean energy ambitions<
216208
</p>
217209
</mdc-ripple>
218210
<mdc-list-divider></mdc-list-divider>
219-
<mdc-card-actions [fullBleed]="true">
211+
<mdc-card-actions fullBleed>
220212
<button mdc-button mdcCardAction="button">
221213
All Business Headlines
222214
<mdc-icon>arrow_forward</mdc-icon>
@@ -225,30 +217,32 @@ <h2 class="demo-card-article__title" mdcHeadline5>Asia's clean energy ambitions<
225217
</mdc-card>
226218

227219
<mdc-card class="demo-card demo-card--photo">
228-
<mdc-card-primary-action mdc-ripple>
229-
<mdc-card-media [square]="true" class="demo-card__media">
220+
<mdc-card-primary-action>
221+
<mdc-card-media square class="demo-card__media">
230222
<mdc-card-media-content class="demo-card__media-content--with-title">
231223
<div class="demo-card__media-title" mdcSubtitle2>Vacation Photos</div>
232224
</mdc-card-media-content>
233225
</mdc-card-media>
234226
</mdc-card-primary-action>
235-
<mdc-card-actions [icons]="true">
236-
<button mdcIconButton mdcCardAction="icon">
237-
<mdc-icon mdcIconOn>favorite</mdc-icon>
238-
<mdc-icon>favorite_border</mdc-icon>
239-
</button>
240-
<button mdcIconButton mdcCardAction="icon">
241-
<mdc-icon mdcIconOn>bookmark</mdc-icon>
242-
<mdc-icon>bookmark_border</mdc-icon>
243-
</button>
244-
<mdc-icon mdcCardAction="icon" mdcRipple>share</mdc-icon>
227+
<mdc-card-actions>
228+
<mdc-card-action-icons>
229+
<button mdcIconButton mdcCardAction="icon">
230+
<mdc-icon mdcIconOn>favorite</mdc-icon>
231+
<mdc-icon>favorite_border</mdc-icon>
232+
</button>
233+
<button mdcIconButton mdcCardAction="icon">
234+
<mdc-icon mdcIconOn>bookmark</mdc-icon>
235+
<mdc-icon>bookmark_border</mdc-icon>
236+
</button>
237+
<mdc-icon mdcCardAction="icon" mdcRipple>share</mdc-icon>
238+
</mdc-card-action-icons>
245239
</mdc-card-actions>
246240
</mdc-card>
247241

248242
<mdc-card class="demo-card demo-card--music">
249-
<mdc-card-primary-action mdc-ripple>
243+
<mdc-card-primary-action>
250244
<div class="demo-card__music-row">
251-
<mdc-card-media [square]="true" class="demo-card__media demo-card__media--music"></mdc-card-media>
245+
<mdc-card-media square class="demo-card__media demo-card__media--music"></mdc-card-media>
252246
<div class="demo-card__music-info">
253247
<div class="demo-card__music-title" mdcHeadline5>Title</div>
254248
<div class="demo-card__music-artist" mdcBody2>Under the Grave</div>

demos/components/shape-demo/shape-demo.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ <h3 class="demo-content__headline">FAB</h3>
126126
<div class="demo-content">
127127
<h3 class="demo-content__headline">Card</h3>
128128
<mdc-shape-container class="demo-shape-card-container">
129-
<mdc-card [outlined]="true" class="demo-shape-card">
130-
<mdc-card-primary-action mdc-ripple>
129+
<mdc-card outlined class="demo-shape-card">
130+
<mdc-card-primary-action>
131131
<div class="demo-shape-card--row">
132132
<mdc-card-media [square]="true" class="demo-shape-card__media"></mdc-card-media>
133133
<div class="demo-shape-card__info">
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component } from '@angular/core';
22

33
@Component({
4-
selector: 'shape-demo',
54
templateUrl: './shape-demo.html'
65
})
76
export class ShapeDemo { }

demos/sass/_demo.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
position: fixed;
6464
overflow-y: auto;
6565
top: auto;
66-
height: calc(100vh - 54px);
66+
padding-bottom: 64px;
6767

6868
.mdc-list-item {
6969
cursor: pointer;
@@ -75,8 +75,6 @@
7575
//
7676

7777
.demo-page {
78-
display: inline-flex;
79-
flex-direction: column;
8078
padding-bottom: 45px;
8179

8280
@media (min-width: 1240px) {
@@ -96,6 +94,11 @@
9694
margin: 1.5rem;
9795
padding: 1rem;
9896
background-color: $color-white;
97+
max-width: calc(70% - 17rem);
98+
99+
@media (max-width: 1239px) {
100+
max-width: calc(100% - 3rem);
101+
}
99102

100103
&__headline {
101104
@include mdc-typography(headline6);

demos/sass/_docs.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434

3535
.markdown-body {
3636
line-height: 1.5;
37+
padding-left: 10px;
3738
word-wrap: break-word;
38-
margin-top: 0 !important;
39+
max-width: calc(70% - 17rem);
40+
41+
@media (max-width: 1239px) {
42+
max-width: calc(100% - 3rem);
43+
}
3944

4045
h1 {
4146
@include mdc-typography(headline4);
@@ -90,14 +95,13 @@
9095
//
9196

9297
.docs-api table {
93-
margin: 0 12px 7px 0;
9498
border: 1px solid #eee;
9599
border-collapse: collapse;
96100
border-spacing: 0;
97101

98102
td, th {
99103
border: 1px solid #eee;
100-
padding: 12px 12px 12px 24px;
104+
padding: 12px;
101105
}
102106

103107
td:first-child, th:first-child {

demos/sass/_layout.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
.demo-layout__row-with-button {
1616
.mdc-button, .mdc-fab {
17-
margin: 12px;
17+
margin-right: 6px;
18+
margin-bottom: 6px;
1819
}
1920
}
2021

0 commit comments

Comments
 (0)