Skip to content

Commit db94d5e

Browse files
authored
Merge pull request #9380 from IgniteUI/simeonoff/button-fixes
fix(button): themes not working correctly
2 parents ab6fc48 + 34eeeac commit db94d5e

File tree

3 files changed

+62
-19
lines changed

3 files changed

+62
-19
lines changed

projects/igniteui-angular/src/lib/core/styles/base/utilities/_mixins.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
$ignore: ('name', 'palette', 'variant', 'selector');
257257
$webc-prefix: 'igc';
258258
$webc: nth(str-split($name, '-'), 1) == $webc-prefix;
259+
$themes: map-get($theme, 'themes');
259260

260261
@if not($prefix) and $webc {
261262
$prefix: $webc-prefix;
@@ -265,6 +266,12 @@
265266
@error 'Theme should have a non-null or empty name property. Example: my-theme: (name: my-theme)';
266267
}
267268

269+
@if $themes and type-of($themes) == 'map' {
270+
@each $theme in $themes {
271+
@include igx-css-vars(nth($theme, 2));
272+
}
273+
}
274+
268275
@each $key, $value in $theme {
269276
$elevation: str-index($key, 'elevation');
270277

projects/igniteui-angular/src/lib/core/styles/components/button/_button-theme.scss

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@
172172

173173
@return (
174174
palette: $palette,
175+
name: $name,
175176
variant: $variant,
176-
themes: $themes
177+
themes: $themes,
177178
);
178179
}
179180

@@ -195,6 +196,12 @@
195196
$fab-theme: map-get(map-get($theme, 'themes'), 'fab');
196197
$icon-theme: map-get(map-get($theme, 'themes'), 'icon');
197198

199+
@include igx-css-vars($flat-theme);
200+
@include igx-css-vars($outlined-theme);
201+
@include igx-css-vars($raised-theme);
202+
@include igx-css-vars($fab-theme);
203+
@include igx-css-vars($icon-theme);
204+
198205
$time: map-get((
199206
material: .1s,
200207
fluent: .1s,
@@ -293,9 +300,9 @@
293300
), $variant);
294301

295302
$button-floating-padding: (
296-
comfortable: rem(8px) rem(16px),
297-
cosy: rem(4px) rem(12px),
298-
compact: 0 rem(8px)
303+
comfortable: rem(8px) rem(14px),
304+
cosy: rem(4px) rem(10px),
305+
compact: 0 rem(6px)
299306
);
300307

301308
$button-floating-size: (
@@ -411,8 +418,6 @@
411418
}
412419

413420
%igx-button--flat {
414-
@include igx-css-vars($flat-theme, '');
415-
416421
background: --var($flat-theme, 'background');
417422
color: --var($flat-theme, 'foreground');
418423
border-radius: --var($flat-theme, 'border-radius');
@@ -431,8 +436,6 @@
431436
}
432437

433438
%igx-button--outlined {
434-
@include igx-css-vars($outlined-theme, '');
435-
436439
background: --var($outlined-theme, 'background');
437440
color: --var($outlined-theme, 'foreground');
438441
border-radius: --var($outlined-theme, 'border-radius');
@@ -481,8 +484,6 @@
481484
}
482485

483486
%igx-button--raised {
484-
@include igx-css-vars($raised-theme, '');
485-
486487
color: --var($raised-theme, 'foreground');
487488
background: --var($raised-theme, 'background');
488489
box-shadow: $raised-shadow;
@@ -525,8 +526,6 @@
525526
}
526527

527528
%igx-button--fab {
528-
@include igx-css-vars($fab-theme, '');
529-
530529
padding: map-get($button-floating-padding, 'comfortable');
531530
min-width: map-get($button-floating-size, 'comfortable');
532531
min-height: map-get($button-floating-size, 'comfortable');
@@ -584,8 +583,6 @@
584583
}
585584

586585
%igx-button--icon {
587-
@include igx-css-vars($icon-theme, '');
588-
589586
width: $button-icon-width;
590587
height: $button-icon-width;
591588
min-width: unset;

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_button.scss

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ $_material-flat-button: extend(
5151
$_flat-elevation-button,
5252
$_material-shape-button,
5353
(
54+
selector: '[igxButton="flat"]',
55+
5456
background: transparent,
5557

5658
foreground: (
@@ -86,6 +88,8 @@ $_material-flat-button: extend(
8688
$_material-outlined-button: extend(
8789
$_material-flat-button,
8890
(
91+
selector: '[igxButton="outlined"]',
92+
8993
border-color: (
9094
igx-color: ('grays', 300)
9195
),
@@ -120,6 +124,8 @@ $_material-raised-button: extend(
120124
$_material-raised-elevation,
121125
$_material-shape-button,
122126
(
127+
selector: '[igxButton="raised"]',
128+
123129
background: (
124130
igx-color: ('secondary', 500)
125131
),
@@ -158,7 +164,10 @@ $_material-raised-button: extend(
158164
$_material-fab-button: extend(
159165
$_material-raised-button,
160166
$_material-fab-elevation,
161-
$_round-shape-button
167+
$_round-shape-button,
168+
(
169+
selector: '[igxButton="fab"]',
170+
)
162171
);
163172

164173
/// @type {Map}
@@ -181,6 +190,8 @@ $_material-icon-button: extend(
181190
$_material-ib-elevation,
182191
$_round-shape-button,
183192
(
193+
selector: '[igxButton="icon"]',
194+
184195
background: transparent,
185196

186197
foreground: (
@@ -363,8 +374,11 @@ $_fluent-raised-button: extend(
363374
/// @requires {function} extend
364375
$_fluent-fab-button: extend(
365376
$_fluent-base-button,
366-
$_fluent-raised-button,
367377
$_round-shape-button,
378+
$_fluent-raised-button,
379+
(
380+
selector: '[igxButton="fab"]',
381+
)
368382
);
369383

370384
/// @type {Map}
@@ -552,13 +566,35 @@ $_bootstrap-raised-button: extend(
552566

553567
/// @type {Map}
554568
/// @requires {function} extend
569+
/// @prop {Map} background [igx-color: ('primary', 500)] - The background color of a raised button.
570+
/// @prop {Map} hover-background [igx-color: ('primary', 600)] - The hover background color of an raised button.
571+
/// @prop {Map} focus-background [igx-color: ('primary', 600)] - The focus background color of an raised button.
555572
/// @requires {Map} $_material-fab-button
556573
/// @requires {Map} $_bootstrap-base-button
557574
/// @requires {Map} $_bootstrap-raised-button
558575
$_bootstrap-fab-button: extend(
559576
$_material-fab-button,
560577
$_bootstrap-base-button,
561-
$_bootstrap-raised-button
578+
$_bootstrap-raised-button,
579+
(
580+
selector: '[igxButton="fab"]',
581+
582+
hover-foreground: #fff,
583+
584+
focus-foreground: #fff,
585+
586+
background: (
587+
igx-color: ('primary', 500)
588+
),
589+
590+
hover-background: (
591+
igx-color: ('primary', 600)
592+
),
593+
594+
focus-background: (
595+
igx-color: ('primary', 600)
596+
),
597+
)
562598
);
563599

564600
/// @type {Map}
@@ -573,8 +609,8 @@ $_bootstrap-fab-button: extend(
573609
/// @requires {Map} $_bootstrap-shape-button
574610
/// @requires {function} extend
575611
$_bootstrap-icon-button: extend(
576-
$_material-icon-button,
577612
$_bootstrap-base-button,
613+
$_material-icon-button,
578614
$_bootstrap-shape-button,
579615
(
580616
hover-background: (
@@ -755,7 +791,10 @@ $_indigo-raised-button: extend(
755791
$_indigo-fab-button: extend(
756792
$_material-fab-button,
757793
$_indigo-base-button,
758-
$_indigo-raised-button
794+
$_indigo-raised-button,
795+
(
796+
selector: '[igxButton="fab"]',
797+
)
759798
);
760799

761800
/// @type {Map}

0 commit comments

Comments
 (0)