Skip to content

Commit 4e69e05

Browse files
committed
docs(material/card): add each appearance example
update the example to contain `elevated`, `outlined` & `filled` variants
1 parent 07225d2 commit 4e69e05

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
<mat-card>
2+
<mat-card-content>Elevated</mat-card-content>
3+
</mat-card>
4+
15
<mat-card appearance="outlined">
2-
<mat-card-content>Simple card</mat-card-content>
6+
<mat-card-content>Outlined</mat-card-content>
37
</mat-card>
8+
9+
<mat-card appearance="filled">
10+
<mat-card-content>Filled</mat-card-content>
11+
</mat-card>

src/dev-app/card/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ng_module(
1212
deps = [
1313
"//src/material/button",
1414
"//src/material/card",
15-
"//src/material/checkbox",
15+
"//src/material/radio",
1616
],
1717
)
1818

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<div class="demo-card-container">
2-
<mat-checkbox (change)="toggleAppearance()">Use outlined cards</mat-checkbox>
2+
<mat-radio-group (change)="appearance = $event.value">
3+
<mat-radio-button value="raised">Raised</mat-radio-button>
4+
<mat-radio-button value="outlined">Outlined</mat-radio-button>
5+
<mat-radio-button value="filled">Filled</mat-radio-button>
6+
</mat-radio-group>
37

48
<!-- TODO(jelbourn): re-add dividers and footers with progress bars once the MDC versions exist -->
59
<mat-card [appearance]="appearance">

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

+4
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@
1616
text-transform: uppercase;
1717
}
1818
}
19+
20+
mat-radio-group {
21+
margin-bottom: 10px;
22+
}

src/dev-app/card/card-demo.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/co
1010
import {FormsModule} from '@angular/forms';
1111
import {MatButtonModule} from '@angular/material/button';
1212
import {MatCardAppearance, MatCardModule} from '@angular/material/card';
13-
import {MatCheckboxModule} from '@angular/material/checkbox';
13+
import {MatRadioModule} from '@angular/material/radio';
1414

1515
@Component({
1616
selector: 'card-demo',
1717
templateUrl: 'card-demo.html',
1818
styleUrl: 'card-demo.css',
1919
encapsulation: ViewEncapsulation.None,
2020
standalone: true,
21-
imports: [MatCardModule, MatButtonModule, MatCheckboxModule, FormsModule],
21+
imports: [MatCardModule, MatButtonModule, MatRadioModule, FormsModule],
2222
changeDetection: ChangeDetectionStrategy.OnPush,
2323
})
2424
export class CardDemo {
@@ -29,7 +29,4 @@ export class CardDemo {
2929
As of some one gently rapping, rapping at my chamber door.
3030
“’Tis some visitor,” I muttered, “tapping at my chamber door—
3131
Only this and nothing more.”`;
32-
toggleAppearance() {
33-
this.appearance = this.appearance == 'raised' ? 'outlined' : 'raised';
34-
}
3532
}

src/material/card/_card-theme.scss

+1-5
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@
9898
tokens-mdc-outlined-card.$prefix,
9999
tokens-mdc-outlined-card.get-density-tokens($theme)
100100
);
101-
@include token-utils.create-token-values(
102-
tokens-mdc-outlined-card.$prefix,
103-
tokens-mdc-outlined-card.get-density-tokens($theme)
104-
);
105101
@include token-utils.create-token-values(
106102
tokens-mdc-filled-card.$prefix,
107103
tokens-mdc-filled-card.get-density-tokens($theme)
@@ -134,7 +130,7 @@
134130
(
135131
namespace: tokens-mdc-filled-card.$prefix,
136132
tokens: tokens-mdc-filled-card.get-token-slots(),
137-
prefix: 'outlined-',
133+
prefix: 'filled-',
138134
)
139135
);
140136
}

0 commit comments

Comments
 (0)