|
1 |
| -@use 'sass:map'; |
2 |
| -@use '../core/mdc-helpers/mdc-helpers'; |
3 | 1 | @use '../core/theming/theming';
|
4 | 2 | @use '../core/style/private';
|
5 | 3 | @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; |
| 4 | +@use '../core/tokens/token-utils'; |
| 5 | +@use '../core/tokens/m2/mat/card' as tokens-mat-card; |
| 6 | +@use '../core/tokens/m2/mdc/elevated-card' as tokens-mdc-elevated-card; |
| 7 | +@use '../core/tokens/m2/mdc/outlined-card' as tokens-mdc-outlined-card; |
8 | 8 | @use '@material/card/elevated-card-theme' as mdc-elevated-card-theme;
|
9 | 9 | @use '@material/card/outlined-card-theme' as mdc-outlined-card-theme;
|
10 |
| -@use '@material/typography' as mdc-typography; |
11 | 10 |
|
12 | 11 | @mixin color($config-or-theme) {
|
13 | 12 | $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); |
| 13 | + $mdc-elevated-card-color-tokens: tokens-mdc-elevated-card.get-color-tokens($config); |
| 14 | + $mdc-outlined-card-color-tokens: tokens-mdc-outlined-card.get-color-tokens($config); |
| 15 | + $mat-card-color-tokens: tokens-mat-card.get-color-tokens($config); |
16 | 16 |
|
17 |
| - // Add values for MDC card tokens. |
| 17 | + // Add values for card tokens. |
18 | 18 | .mat-mdc-card {
|
19 | 19 | @include mdc-elevated-card-theme.theme($mdc-elevated-card-color-tokens);
|
20 | 20 | @include mdc-outlined-card-theme.theme($mdc-outlined-card-color-tokens);
|
| 21 | + @include token-utils.create-token-values(tokens-mat-card.$prefix, $mat-card-color-tokens); |
21 | 22 |
|
22 | 23 | // TODO(mmalerba): This should be based on tokens, but the elevation tokens don't seem to be
|
23 | 24 | // working currently. They wind up setting values like `box-shadow: var(--e); --e: 1`
|
|
29 | 30 | // working currently. They wind up setting values like `box-shadow: var(--e); --e: 1`
|
30 | 31 | @include private.private-theme-elevation(0, $config);
|
31 | 32 | }
|
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 | 33 | }
|
40 | 34 |
|
41 | 35 | @mixin typography($config-or-theme) {
|
42 | 36 | $config: typography.private-typography-to-2018-config(
|
43 | 37 | 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); |
| 38 | + $mdc-elevated-card-typography-tokens: tokens-mdc-elevated-card.get-typography-tokens($config); |
| 39 | + $mdc-outlined-card-typography-tokens: tokens-mdc-outlined-card.get-typography-tokens($config); |
| 40 | + $mat-card-typography-tokens: tokens-mat-card.get-typography-tokens($config); |
46 | 41 |
|
47 |
| - // Add values for MDC card tokens. |
| 42 | + // Add values for card tokens. |
48 | 43 | .mat-mdc-card {
|
49 | 44 | @include mdc-elevated-card-theme.theme($mdc-elevated-card-typography-tokens);
|
50 | 45 | @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 |
| - } |
| 46 | + @include token-utils.create-token-values(tokens-mat-card.$prefix, $mat-card-typography-tokens); |
64 | 47 | }
|
65 | 48 | }
|
66 | 49 |
|
67 | 50 | @mixin density($config-or-theme) {
|
68 | 51 | $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); |
| 52 | + $mdc-elevated-card-density-tokens: tokens-mdc-elevated-card.get-density-tokens($density-scale); |
| 53 | + $mdc-outlined-card-density-tokens: tokens-mdc-outlined-card.get-density-tokens($density-scale); |
| 54 | + $mat-card-density-tokens: tokens-mat-card.get-density-tokens($density-scale); |
71 | 55 |
|
72 |
| - // Add values for MDC card tokens. |
| 56 | + // Add values for card tokens. |
73 | 57 | .mat-mdc-card {
|
74 | 58 | @include mdc-elevated-card-theme.theme($mdc-elevated-card-density-tokens);
|
75 | 59 | @include mdc-outlined-card-theme.theme($mdc-outlined-card-density-tokens);
|
| 60 | + @include token-utils.create-token-values(tokens-mat-card.$prefix, $mat-card-density-tokens); |
76 | 61 | }
|
77 | 62 | }
|
78 | 63 |
|
|
0 commit comments