|
3 | 3 | @use '../core/theming/theming';
|
4 | 4 | @use '../core/style/private';
|
5 | 5 | @use '../core/typography/typography';
|
6 |
| -@use '../core/tokens/m2/mdc/elevated-card' as m2-mdc-elevated-card; |
7 |
| -@use '../core/tokens/m2/mdc/outlined-card' as m2-mdc-outlined-card; |
| 6 | +@use '../core/tokens/token-utils'; |
| 7 | +@use '../core/tokens/m2/mat/card' as tokens-mat-card; |
| 8 | +@use '../core/tokens/m2/mdc/elevated-card' as tokens-mdc-elevated-card; |
| 9 | +@use '../core/tokens/m2/mdc/outlined-card' as tokens-mdc-outlined-card; |
8 | 10 | @use '@material/card/elevated-card-theme' as mdc-elevated-card-theme;
|
9 | 11 | @use '@material/card/outlined-card-theme' as mdc-outlined-card-theme;
|
10 | 12 | @use '@material/typography' as mdc-typography;
|
11 | 13 |
|
12 | 14 | @mixin color($config-or-theme) {
|
13 | 15 | $config: theming.get-color-config($config-or-theme);
|
14 |
| - $mdc-elevated-card-color-tokens: m2-mdc-elevated-card.get-color-tokens($config); |
15 |
| - $mdc-outlined-card-color-tokens: m2-mdc-outlined-card.get-color-tokens($config); |
| 16 | + $mdc-elevated-card-color-tokens: tokens-mdc-elevated-card.get-color-tokens($config); |
| 17 | + $mdc-outlined-card-color-tokens: tokens-mdc-outlined-card.get-color-tokens($config); |
| 18 | + $mat-card-color-tokens: tokens-mat-card.get-color-tokens($config); |
16 | 19 |
|
17 |
| - // Add values for MDC card tokens. |
| 20 | + // Add values for card tokens. |
18 | 21 | .mat-mdc-card {
|
19 | 22 | @include mdc-elevated-card-theme.theme($mdc-elevated-card-color-tokens);
|
20 | 23 | @include mdc-outlined-card-theme.theme($mdc-outlined-card-color-tokens);
|
| 24 | + @include token-utils.create-token-values(tokens-mat-card.$prefix, $mat-card-color-tokens); |
21 | 25 |
|
22 | 26 | // TODO(mmalerba): This should be based on tokens, but the elevation tokens don't seem to be
|
23 | 27 | // working currently. They wind up setting values like `box-shadow: var(--e); --e: 1`
|
|
29 | 33 | // working currently. They wind up setting values like `box-shadow: var(--e); --e: 1`
|
30 | 34 | @include private.private-theme-elevation(0, $config);
|
31 | 35 | }
|
32 |
| - |
33 |
| - // Card subtitles are an Angular Material construct (not part of MDC), |
34 |
| - // so we add their color styles here. |
35 |
| - // TODO(mmalerba): Add custom tokens for this. |
36 |
| - .mat-mdc-card-subtitle { |
37 |
| - color: theming.get-color-from-palette(map.get($config, foreground), secondary-text); |
38 |
| - } |
39 | 36 | }
|
40 | 37 |
|
41 | 38 | @mixin typography($config-or-theme) {
|
42 | 39 | $config: typography.private-typography-to-2018-config(
|
43 | 40 | theming.get-typography-config($config-or-theme));
|
44 |
| - $mdc-elevated-card-typography-tokens: m2-mdc-elevated-card.get-typography-tokens($config); |
45 |
| - $mdc-outlined-card-typography-tokens: m2-mdc-outlined-card.get-typography-tokens($config); |
| 41 | + $mdc-elevated-card-typography-tokens: tokens-mdc-elevated-card.get-typography-tokens($config); |
| 42 | + $mdc-outlined-card-typography-tokens: tokens-mdc-outlined-card.get-typography-tokens($config); |
| 43 | + $mat-card-typography-tokens: tokens-mat-card.get-typography-tokens($config); |
46 | 44 |
|
47 |
| - // Add values for MDC card tokens. |
| 45 | + // Add values for card tokens. |
48 | 46 | .mat-mdc-card {
|
49 | 47 | @include mdc-elevated-card-theme.theme($mdc-elevated-card-typography-tokens);
|
50 | 48 | @include mdc-outlined-card-theme.theme($mdc-outlined-card-typography-tokens);
|
51 |
| - |
52 |
| - // Card subtitles and titles are an Angular Material construct (not part of MDC), |
53 |
| - // so we explicitly set their typographic styles here. |
54 |
| - // TODO(mmalerba): Add custom tokens for this. |
55 |
| - @include mdc-helpers.using-mdc-typography($config) { |
56 |
| - .mat-mdc-card-title { |
57 |
| - @include mdc-typography.typography(headline6); |
58 |
| - } |
59 |
| - |
60 |
| - .mat-mdc-card-subtitle { |
61 |
| - @include mdc-typography.typography(subtitle2); |
62 |
| - } |
63 |
| - } |
| 49 | + @include token-utils.create-token-values(tokens-mat-card.$prefix, $mat-card-typography-tokens); |
64 | 50 | }
|
65 | 51 | }
|
66 | 52 |
|
67 | 53 | @mixin density($config-or-theme) {
|
68 | 54 | $density-scale: theming.get-density-config($config-or-theme);
|
69 |
| - $mdc-elevated-card-density-tokens: m2-mdc-elevated-card.get-density-tokens($density-scale); |
70 |
| - $mdc-outlined-card-density-tokens: m2-mdc-outlined-card.get-density-tokens($density-scale); |
| 55 | + $mdc-elevated-card-density-tokens: tokens-mdc-elevated-card.get-density-tokens($density-scale); |
| 56 | + $mdc-outlined-card-density-tokens: tokens-mdc-outlined-card.get-density-tokens($density-scale); |
| 57 | + $mat-card-density-tokens: tokens-mat-card.get-density-tokens($density-scale); |
71 | 58 |
|
72 |
| - // Add values for MDC card tokens. |
| 59 | + // Add values for card tokens. |
73 | 60 | .mat-mdc-card {
|
74 | 61 | @include mdc-elevated-card-theme.theme($mdc-elevated-card-density-tokens);
|
75 | 62 | @include mdc-outlined-card-theme.theme($mdc-outlined-card-density-tokens);
|
| 63 | + @include token-utils.create-token-values(tokens-mat-card.$prefix, $mat-card-density-tokens); |
76 | 64 | }
|
77 | 65 | }
|
78 | 66 |
|
|
0 commit comments