Skip to content

Commit e90c997

Browse files
authored
Merge pull request #7784 from IgniteUI/simeonoff/fix-7783
fix(typography): incorrectly compiled custom typography styles
2 parents 0c989ce + 330daef commit e90c997

File tree

1 file changed

+38
-42
lines changed

1 file changed

+38
-42
lines changed

projects/igniteui-angular/src/lib/core/styles/typography/_typography.scss

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -47,48 +47,6 @@
4747
-webkit-font-smoothing: antialiased;
4848
-moz-osx-font-smoothing: grayscale;
4949

50-
$this: bem--selector-to-string(&);
51-
$selector: bem--extract-first-selector($this);
52-
53-
// Maps type scale typographic categories
54-
// to native elements.
55-
$category-element-map: (
56-
h1: 'h1',
57-
h2: 'h2',
58-
h3: 'h3',
59-
h4: 'h4',
60-
h5: 'h5',
61-
h6: 'h6',
62-
body-1: 'p'
63-
);
64-
65-
@each $category, $type-style in $type-scale {
66-
// Get the native element that uses typographic styles directly
67-
// as mapped in the $category-element-map
68-
$e: map-get($category-element-map, $category);
69-
70-
// Create a placeholder selector with styles for each
71-
// typographic style to be able to easily extend it
72-
// elsewhere.
73-
%#{$category} {
74-
@include igx-type-style($type-scale, $category);
75-
}
76-
77-
// Add native element typographic styles.
78-
@if $e != null {
79-
#{$e} {
80-
@extend %#{$category};
81-
}
82-
}
83-
84-
// Add class selector typographic styles.
85-
@if ($selector == '.igx-typography') {
86-
@include e(#{$category}) {
87-
@extend %#{$category};
88-
}
89-
}
90-
}
91-
9250
// Call the individual component styles with the type scale
9351
@include _excel-filtering-typography($type-scale);
9452
@include igx-banner-typography($type-scale);
@@ -142,6 +100,44 @@
142100
// and all typographic elements.
143101
@include b(igx-typography) {
144102
@include _igx-typography-styles($font-family, $type-scale);
103+
104+
// Maps type scale typographic categories
105+
// to native elements.
106+
$category-element-map: (
107+
h1: 'h1',
108+
h2: 'h2',
109+
h3: 'h3',
110+
h4: 'h4',
111+
h5: 'h5',
112+
h6: 'h6',
113+
body-1: 'p'
114+
);
115+
116+
@each $category, $type-style in $type-scale {
117+
// Get the native element that uses typographic styles directly
118+
// as mapped in the $category-element-map
119+
$e: map-get($category-element-map, $category);
120+
121+
// Create a placeholder selector with styles for each
122+
// typographic style to be able to easily extend it
123+
// elsewhere.
124+
%#{$category} {
125+
@include igx-type-style($type-scale, $category);
126+
}
127+
128+
// Add native element typographic styles.
129+
@if $e != null {
130+
// stylelint-disable-next-line max-nesting-depth
131+
#{$e} {
132+
@extend %#{$category};
133+
}
134+
}
135+
136+
// Add class selector typographic styles.
137+
@include e(#{$category}) {
138+
@extend %#{$category};
139+
}
140+
}
145141
}
146142
} @else {
147143
@include _igx-typography-styles($font-family, $type-scale);

0 commit comments

Comments
 (0)