Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@mixin mat-typography-level-to-styles #8700

Closed
raciasolvo opened this issue Nov 29, 2017 · 3 comments · Fixed by #8721
Closed

@mixin mat-typography-level-to-styles #8700

raciasolvo opened this issue Nov 29, 2017 · 3 comments · Fixed by #8721
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@raciasolvo
Copy link

Bug, feature request, or proposal:

Bug or proposal

What is the current behavior?

https://github.com/angular/material2/blob/3b41c0c23e10fc74d9f687427f80c46f5da419c9/src/lib/core/typography/_typography-utils.scss#L32

@mixin mat-typography-level-to-styles($config, $level) {
  $font-size: mat-font-size($config, $level);
  $font-weight: mat-font-weight($config, $level);
  $line-height: mat-line-height($config, $level);
  $font-family: mat-font-family($config, $level);

  // Use the shorthand `font` to represent a typography level, because it's the shortest. Notes that
  // we need to use interpolation for `font-size/line-height` in order to prevent SASS from dividing
  // the two values.
  font: $font-weight #{$font-size}/#{$line-height} $font-family;
}

What is the expected behavior?

/ We rewrite the Angular Material mixin because they use the shorthand `font`
// which can't use `inherit` for `font-family`
@mixin mat-typography-level-to-styles($config, $level) {
	$font-size: mat-font-size($config, $level);
	$font-weight: mat-font-weight($config, $level);
	$line-height: mat-line-height($config, $level);
	$font-family: mat-font-family($config, $level);

	font: {
		family: $font-family;
		weight: $font-weight;
		size: $font-size;
	}
	line-height: $line-height;
}

What is the use-case or motivation for changing an existing behavior?

The shorthand font can't use inherit for font-family

// We use 'font-family' on body only and rewrite 'font-family' used Angular Material in components
// It's simple method for translating App and styling whole App
$app-typography: mat-typography-config(
  	$font-family: 'inherit'
);

// Extend Material2 Typography
$font-families: (
	en: (font-family: 'Roboto, "Helvetica Neue", sans-serif'),
	zh: (font-family: 'Roboto, "Noto Sans SC", "Helvetica Neue", sans-serif')
);
$app-typography: map_merge($app-typography, $font-families);
@crisbeto
Copy link
Member

I think it still makes sense to use the shorthand so we can save some bytes, but we can conditionally fall back to the individual properties if the font family is inherit.

@crisbeto crisbeto self-assigned this Nov 29, 2017
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Nov 29, 2017
@aciccarello
Copy link

PR is #8721

crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 30, 2017
Fixes the `mat-typography-level-to-styles` mixin generating an invalid style declaration if any of its value are set to `inherit`.

Fixes angular#8700.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 2, 2017
Fixes the `mat-typography-level-to-styles` mixin generating an invalid style declaration if any of its value are set to `inherit`.

Fixes angular#8700.
andrewseguin pushed a commit that referenced this issue Dec 13, 2017
Fixes the `mat-typography-level-to-styles` mixin generating an invalid style declaration if any of its value are set to `inherit`.

Fixes #8700.
andrewseguin pushed a commit to andrewseguin/components that referenced this issue Dec 19, 2017
…lar#8721)

Fixes the `mat-typography-level-to-styles` mixin generating an invalid style declaration if any of its value are set to `inherit`.

Fixes angular#8700.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants