Skip to content

Commit

Permalink
fix(list,menu)!: move to -text-type tokens
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 510452426
  • Loading branch information
dfreedm authored and copybara-github committed Feb 17, 2023
1 parent 816762d commit 45a6d45
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
38 changes: 18 additions & 20 deletions list/lib/listitem/_list-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
@use '../../../ripple/ripple';
@use '../../../sass/map-ext';
@use '../../../sass/theme';
@use '../../../sass/typography';
@use '../../../tokens';
@use '../icon/list-item-icon';
@use '../image/list-item-image';
@use '../video/list-item-video';
// go/keep-sorted end

@mixin theme($tokens) {
$tokens: theme.validate-theme(tokens.md-comp-list-values(), $tokens);
$tokens: resolve-tokens($tokens);
$tokens: theme.create-theme-vars($tokens, list);
$tokens: theme.validate-theme(
resolve-tokens(tokens.md-comp-list-values()),
resolve-tokens($tokens)
);
$tokens: theme.create-theme-vars($tokens, 'list');

@include theme.emit-theme-vars($tokens);
}
Expand Down Expand Up @@ -197,11 +200,7 @@
.label-text {
display: flex;
color: var(--_list-item-label-text-color);
font-family: var(--_list-item-label-text-font);
font-size: var(--_list-item-label-text-size);
letter-spacing: var(--_list-item-label-text-tracking);
font-weight: var(--_list-item-label-text-weight);
line-height: var(--_list-item-label-text-line-height);
font: var(--_list-item-label-text-type);

.disabled & {
color: var(--_list-item-disabled-label-text-color);
Expand All @@ -217,11 +216,7 @@
overflow: hidden;
width: 100%;
color: var(--_list-item-supporting-text-color);
font-family: var(--_list-item-supporting-text-font);
font-size: var(--_list-item-supporting-text-size);
letter-spacing: var(--_list-item-supporting-text-tracking);
font-weight: var(--_list-item-supporting-text-weight);
line-height: var(--_list-item-supporting-text-line-height);
font: var(--_list-item-supporting-text-type);

.disabled & {
color: var(--_list-item-disabled-label-text-color);
Expand All @@ -239,11 +234,7 @@

.trailing-supporting-text {
padding-inline-start: 16px;
font-family: var(--_list-item-trailing-supporting-text-font);
font-size: var(--_list-item-trailing-supporting-text-size);
letter-spacing: var(--_list-item-trailing-supporting-text-tracking);
font-weight: var(--_list-item-trailing-supporting-text-weight);
line-height: var(--_list-item-trailing-supporting-text-line-height);
font: var(--_list-item-trailing-supporting-text-type);

.list-item:not(.disabled) & {
color: var(--_list-item-trailing-supporting-text-color);
Expand Down Expand Up @@ -277,18 +268,25 @@
$list-item-tokens: ();

@each $token, $value in $tokens {
$index: string.index($token, list-item);
$index: string.index($token, 'list-item');

@if $index {
$list-item-tokens: map.set($list-item-tokens, $token, $value);
}
}

$list-item-tokens: typography.resolve-tokens(
$list-item-tokens,
'list-item-label-text',
'list-item-supporting-text',
'list-item-trailing-supporting-text'
);
@return $list-item-tokens;
}

@mixin private-props() {
$tokens: resolve-tokens(tokens.md-comp-list-values());
$tokens: theme.create-theme-vars($tokens, list);
$tokens: theme.create-theme-vars($tokens, 'list');

:host {
@each $token, $value in $tokens {
Expand Down
8 changes: 6 additions & 2 deletions list/test/assets.ts

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions menu/lib/menuitem/_menu-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
@use '../../../list/list-item';
@use '../../../ripple/ripple';
@use '../../../sass/map-ext';
@use '../../../sass/resolvers';
@use '../../../sass/string-ext';
@use '../../../sass/theme';
@use '../../../sass/typography';
@use '../../../tokens';
// go/keep-sorted end

$_custom-property-prefix: 'menu';

@mixin theme($theme) {
$reference: tokens.md-comp-menu-values();
$reference: resolve-tokens(tokens.md-comp-menu-values());
$theme: theme.validate-theme($reference, $theme);
$theme: resolve-tokens($theme);
$theme: theme.create-theme-vars($theme, $_custom-property-prefix);
Expand Down Expand Up @@ -103,6 +103,11 @@ $_custom-property-prefix: 'menu';
}
}

$list-item-tokens: typography.resolve-tokens(
$list-item-tokens,
'list-item-label-text'
);

@return $list-item-tokens;
}

Expand Down

0 comments on commit 45a6d45

Please sign in to comment.