fundamental icon indicating copy to clipboard operation
fundamental copied to clipboard

[Lib] Implement additional type mixins

Open xak opened this issue 6 years ago • 0 comments

The design system has presets for various types of text so these should be easily available for authors to access.

Value

  • Different text types can use different weights and styles and those can be preprogrammed.
  • Developers can rely on more specific mixins for different text types instead of having to learn the base "-1" to "6" system.
  • The base type scale can now be concerned only with font-size and line-height.

See https://zpl.io/2GOBx9m screen shot 2018-10-12 at 3 27 05 pm

Proposal

  • [ ] Remove the type, weight and transform values from the $fd-type map.
"0": #{14/$fd-type--base}rem 20/14, //14/20
  • [ ] Create a mixins/_type.scss file to hold the mixins below.

We want to move to small mixin files grouped by functionality.

@mixin fd-type($size: "0", $weight: default) {
}
  • [ ] Add text type mappings to settings to match the styles with the base type sizes
$fd-type-controls: () !default;
$fd-type-controls: map-merge((
  "1": 1 regular,
  "2": 0 regular
  "3": -1 regular
), $fd-type-controls);
$type $size scale size weight
control 1 1 regular
control 2 0 regular
control 3 -1 regular
title 1 5 light
title 2 4 regular
title 3 3 regular
title 4 2 regular
title 5 1 regular
title 6 0 regular
display 1 6 light
display 2 5 light
display 3 2 light
  • [ ] Create convenience mixins for each text type — fd-text-control($size), fd-text-title($size), fd-text-display($size).

These mixins can call the core fd-type() mixin after looking up the proper values in the appropriate map.

  • [ ] Add helpers for each text type, e.g., fd-has-text-control-1, fd-has-text-title-6, fd-has-text-display-2.

xak avatar Oct 12 '18 20:10 xak