Skip to content

Commit 3d38768

Browse files
committed
feat(card): add alignment shortcuts for md-card-actions
1 parent 0672356 commit 3d38768

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

src/components/card/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ Output:
5151

5252
<img src="https://material.angularjs.org/material2_assets/cards/sections-card-min.png">
5353

54+
#### Preset shortcuts
55+
56+
`md-card-actions` has a few layout shortcuts. You can add `align="end"` to align the buttons at the end of
57+
the main axis (flex-end) or `align="column"` to arrange your action buttons in a column. The default is
58+
`align="start"` (flex-start).
59+
5460
### Preset layouts
5561

5662
You can also leverage preset layouts that format some of the sections together.

src/components/card/card.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ md-card-actions {
5555
margin-left: -16px;
5656
margin-right: -16px;
5757
padding: 8px 0;
58+
59+
&[align='end'] {
60+
display: flex;
61+
justify-content: flex-end;
62+
}
63+
64+
&[align='column'] {
65+
display: flex;
66+
flex-direction: column;
67+
}
5868
}
5969

6070
[md-card-image] {

src/demo-app/card/card-demo.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<md-card-content>
2727
<p>Here is some content</p>
2828
</md-card-content>
29+
<md-card-actions align="end">
30+
<button md-button>LIKE</button>
31+
<button md-button>SHARE</button>
32+
</md-card-actions>
2933
</md-card>
3034

3135
<md-card>
@@ -42,7 +46,7 @@
4246

4347
<md-card class="demo-card-blue md-card-flat">
4448
<md-card-title>Easily customizable</md-card-title>
45-
<md-card-actions>
49+
<md-card-actions align="column">
4650
<button md-button>First</button>
4751
<button md-button>Second</button>
4852
</md-card-actions>

src/demo-app/card/card-demo.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,4 @@
1414

1515
.demo-card-blue {
1616
background-color: #B0BECC;
17-
18-
md-card-actions {
19-
display: flex;
20-
flex-direction: column;
21-
}
2217
}

0 commit comments

Comments
 (0)