Skip to content

Commit

Permalink
✨ feat(font.scss): Add letter spacing util classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiderpig86 committed Feb 10, 2022
1 parent db01875 commit 4d6f8a8
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 4 deletions.
29 changes: 29 additions & 0 deletions dist/cirrus-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,35 @@ kbd {
vertical-align: baseline;
}

/* Letter spacing */
.tracking-tightest {
letter-spacing: -0.075em !important;
}

.tracking-tighter {
letter-spacing: -0.05em !important;
}

.tracking-tight {
letter-spacing: -0.025em !important;
}

.tracking-normal {
letter-spacing: 0 !important;
}

.tracking-loose {
letter-spacing: 0.025em !important;
}

.tracking-looser {
letter-spacing: 0.05em !important;
}

.tracking-loosest {
letter-spacing: 0.1em !important;
}

/* MOBILE */
@media screen and (max-width: 639px) {
h6 {
Expand Down
2 changes: 1 addition & 1 deletion dist/cirrus-core.min.css

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions dist/cirrus.css
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,35 @@ kbd {
vertical-align: baseline;
}

/* Letter spacing */
.tracking-tightest {
letter-spacing: -0.075em !important;
}

.tracking-tighter {
letter-spacing: -0.05em !important;
}

.tracking-tight {
letter-spacing: -0.025em !important;
}

.tracking-normal {
letter-spacing: 0 !important;
}

.tracking-loose {
letter-spacing: 0.025em !important;
}

.tracking-looser {
letter-spacing: 0.05em !important;
}

.tracking-loosest {
letter-spacing: 0.1em !important;
}

/* MOBILE */
@media screen and (max-width: 639px) {
h6 {
Expand Down
2 changes: 1 addition & 1 deletion dist/cirrus.min.css

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/base/font.scss
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,21 @@ kbd {
vertical-align: baseline;
}

/* Letter spacing */
$generate-utility: should-generate-classes($LETTER-SPACING);

@if $generate-utility {
@include generate-classes-for-viewport-with-map(
$font-letter-spacing,
'letter-spacing',
'tracking-',
#{get-viewport-flag($LETTER-SPACING)}
);
}

/* MOBILE */

@include screen-below($xs) {

@each $class, $property-map in $font-heading-sizes {
#{$class} {
@include explode-properties(map.get($property-map, 'default'));
Expand Down
11 changes: 11 additions & 0 deletions src/internal/_config.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ $default-config: (
headline: (),
text: (),
),
letter-spacing: (),
transforms: (),
weights: (),
),
Expand Down Expand Up @@ -393,6 +394,15 @@ $default-config: (
),
),
),
letter-spacing: (
tightest: -.075em,
tighter: -.05em,
tight: -.025em,
normal: 0,
loose: .025em,
looser: .05em,
loosest: .1em,
),
transforms: (uppercase: uppercase, lowercase: lowercase, capitalize: capitalize),
weights: (
'extrathin': 100,
Expand Down Expand Up @@ -674,6 +684,7 @@ $form-label-sizes: functions.get-with-extend($all-config, form-label-sizes);
$font-heading-sizes: functions.get-with-extend($all-config, fonts, sizes, heading);
$font-headline-sizes: functions.get-with-extend($all-config, fonts, sizes, headline);
$font-text-sizes: functions.get-with-extend($all-config, fonts, sizes, text);
$font-letter-spacing: functions.get-with-extend($all-config, fonts, letter-spacing);
$font-transforms: functions.get-with-extend($all-config, fonts, transforms);
$font-weights: functions.get-with-extend($all-config, fonts, weights);

Expand Down
1 change: 1 addition & 0 deletions src/internal/_flags.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ $GAP: 'GAP';
$GRID: 'GRID';
$ROUND: 'ROUND';
$SHADOWS: 'SHADOWS';
$LETTER-SPACING: 'LETTER-SPACING';
2 changes: 1 addition & 1 deletion src/utils/shadows.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$generate-utility: should-generate-classes($SHADOWS);

@if $generate-utility {
@include generate-styles-with-viewports($generate-viewports: false) using ($viewport) {
@include generate-styles-with-viewports($generate-viewports: #{get-viewport-flag($SHADOWS)}) using ($viewport) {
$suffix: if($viewport != '', '-#{$viewport}', '');

@each $class, $property-map in $shadows {
Expand Down

0 comments on commit 4d6f8a8

Please sign in to comment.