[6a3a178] | 1 | @use 'sass:map';
|
---|
| 2 | @use '../core/theming/theming';
|
---|
| 3 | @use '../core/style/private';
|
---|
| 4 | @use '../core/typography/typography';
|
---|
| 5 | @use '../core/typography/typography-utils';
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | @mixin color($config-or-theme) {
|
---|
| 9 | $config: theming.get-color-config($config-or-theme);
|
---|
| 10 | $background: map.get($config, background);
|
---|
| 11 | $foreground: map.get($config, foreground);
|
---|
| 12 |
|
---|
| 13 | .mat-card {
|
---|
| 14 | @include private.private-theme-overridable-elevation(1, $config);
|
---|
| 15 | background: theming.get-color-from-palette($background, card);
|
---|
| 16 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 17 |
|
---|
| 18 | // Needs extra specificity to be able to override the elevation selectors.
|
---|
| 19 | &.mat-card-flat {
|
---|
| 20 | @include private.private-theme-overridable-elevation(0, $config);
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | .mat-card-subtitle {
|
---|
| 25 | color: theming.get-color-from-palette($foreground, secondary-text);
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | @mixin typography($config-or-theme) {
|
---|
| 30 | $config: typography.private-typography-to-2014-config(
|
---|
| 31 | theming.get-typography-config($config-or-theme));
|
---|
| 32 | .mat-card {
|
---|
| 33 | font-family: typography-utils.font-family($config);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | .mat-card-title {
|
---|
| 37 | font: {
|
---|
| 38 | size: typography-utils.font-size($config, headline);
|
---|
| 39 | weight: typography-utils.font-weight($config, title);
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | .mat-card-header .mat-card-title {
|
---|
| 44 | font-size: typography-utils.font-size($config, title);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | .mat-card-subtitle,
|
---|
| 48 | .mat-card-content {
|
---|
| 49 | font-size: typography-utils.font-size($config, body-1);
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | @mixin _density($config-or-theme) {}
|
---|
| 54 |
|
---|
| 55 | @mixin theme($theme-or-color-config) {
|
---|
| 56 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
| 57 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-card') {
|
---|
| 58 | $color: theming.get-color-config($theme);
|
---|
| 59 | $density: theming.get-density-config($theme);
|
---|
| 60 | $typography: theming.get-typography-config($theme);
|
---|
| 61 |
|
---|
| 62 | @if $color != null {
|
---|
| 63 | @include color($color);
|
---|
| 64 | }
|
---|
| 65 | @if $density != null {
|
---|
| 66 | @include _density($density);
|
---|
| 67 | }
|
---|
| 68 | @if $typography != null {
|
---|
| 69 | @include typography($typography);
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 | }
|
---|