Skip to content

Commit d4e2396

Browse files
authored
refactor(banner): bundle styles with component (#15467)
1 parent 4b834bf commit d4e2396

File tree

15 files changed

+176
-14
lines changed

15 files changed

+176
-14
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@use 'themes/base';
2+
@use 'themes/shared';
3+
@use 'themes/light';
4+
@use 'themes/dark';

projects/igniteui-angular/src/lib/banner/banner.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
HostBinding,
77
Input,
88
Output,
9-
ViewChild
9+
ViewChild,
10+
ViewEncapsulation
1011
} from '@angular/core';
1112

1213
import { IgxIconComponent } from '../icon/icon.component';
@@ -48,6 +49,8 @@ export interface BannerCancelEventArgs extends BannerEventArgs, CancelableEventA
4849
@Component({
4950
selector: 'igx-banner',
5051
templateUrl: 'banner.component.html',
52+
styleUrl: 'banner.component.css',
53+
encapsulation: ViewEncapsulation.None,
5154
imports: [IgxExpansionPanelComponent, IgxExpansionPanelBodyComponent, IgxButtonDirective, IgxRippleDirective]
5255
})
5356
export class IgxBannerComponent implements IToggleView {
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
@use 'igniteui-theming/sass/animations' as *;
2+
@use 'igniteui-theming/sass/bem' as *;
3+
@use 'igniteui-theming/sass/themes' as *;
4+
@use 'igniteui-theming/sass/typography' as *;
5+
@use 'styles/themes/standalone' as *;
6+
@use 'light/tokens' as *;
7+
8+
$theme: $material;
9+
10+
@include layer(base) {
11+
%actions {
12+
display: flex;
13+
flex-wrap: wrap;
14+
align-self: flex-end;
15+
gap: rem(8px);
16+
17+
> a {
18+
display: inline-flex;
19+
align-items: center;
20+
}
21+
}
22+
23+
%flex-center-block {
24+
display: flex;
25+
align-items: center;
26+
}
27+
28+
@include b(igx-banner-host) {
29+
igx-expansion-panel-body {
30+
padding: 0 !important;
31+
}
32+
}
33+
34+
@include b(igx-banner) {
35+
@include sizable();
36+
--component-size: var(--ig-size, var(--ig-size-large));
37+
38+
display: flex;
39+
justify-content: flex-end;
40+
flex-wrap: wrap;
41+
gap: rem(8px);
42+
padding: rem(16px) rem(8px);
43+
min-width: rem(320px);
44+
background: var-get($theme, 'banner-background');
45+
box-shadow: inset 0 rem(-1px) 0 0 var-get($theme, 'banner-border-color');
46+
border-radius: var-get($theme, 'border-radius');
47+
48+
igc-icon,
49+
igx-icon,
50+
igc-button,
51+
[igxButton] {
52+
--component-size: var(--ig-size, var(--ig-size-large));
53+
}
54+
55+
@include e(message) {
56+
@extend %flex-center-block;
57+
58+
min-width: rem(150px);
59+
flex: 1 0 0%;
60+
gap: rem(16px);
61+
padding: 0 rem(8px);
62+
}
63+
64+
@include e(illustration) {
65+
@extend %flex-center-block;
66+
67+
justify-content: center;
68+
color: var-get($theme, 'banner-illustration-color');
69+
}
70+
71+
@include e(text) {
72+
@include type-style(body-2) {
73+
margin-block: 0;
74+
}
75+
76+
color: var-get($theme, 'banner-message-color');
77+
flex: 1 0 0%;
78+
79+
> *:not(hr) {
80+
margin-block-start: 0 !important;
81+
}
82+
}
83+
84+
@include e(actions) {
85+
@extend %actions;
86+
87+
> igx-banner-actions {
88+
@extend %actions;
89+
}
90+
}
91+
}
92+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@use 'sass:meta';
2+
@use 'tokens';
3+
@use 'styles/themes/standalone' as *;
4+
5+
$tokens: meta.module-variables(tokens);
6+
@include themes(igx-banner, $tokens, dark);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@use 'igniteui-theming/sass/themes' as *;
2+
@use 'igniteui-theming/sass/themes/schemas/components/dark/banner' as *;
3+
4+
$material: digest-schema($dark-material-banner);
5+
$bootstrap: digest-schema($dark-bootstrap-banner);
6+
$fluent: digest-schema($dark-fluent-banner);
7+
$indigo: digest-schema($dark-indigo-banner);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@use 'sass:meta';
2+
@use 'tokens';
3+
@use 'styles/themes/standalone' as *;
4+
5+
$tokens: meta.module-variables(tokens);
6+
@include themes(igx-banner, $tokens, light);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@use 'igniteui-theming/sass/themes' as *;
2+
@use 'igniteui-theming/sass/themes/schemas/components/light/banner' as *;
3+
4+
$base: digest-schema($light-banner);
5+
$material: digest-schema($material-banner);
6+
$bootstrap: digest-schema($bootstrap-banner);
7+
$fluent: digest-schema($fluent-banner);
8+
$indigo: digest-schema($indigo-banner);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@use 'igniteui-theming/sass/bem' as *;
2+
@use 'igniteui-theming/sass/typography' as *;
3+
@use 'styles/themes/standalone' as *;
4+
5+
@include themed-block(igx-banner, fluent) {
6+
@include e(text) {
7+
@include type-style(caption) {
8+
margin-block: 0;
9+
}
10+
}
11+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@forward 'indigo';
2+
@forward 'fluent';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@use 'igniteui-theming/sass/bem' as *;
2+
@use 'igniteui-theming/sass/typography' as *;
3+
@use 'styles/themes/standalone' as *;
4+
@use '../light/tokens' as *;
5+
6+
$theme: $indigo;
7+
8+
@include themed-block(igx-banner, indigo) {
9+
box-shadow: inset 0 0 0 rem(1px) var-get($theme, 'banner-border-color');
10+
padding: rem(16px);
11+
12+
igc-icon,
13+
igx-icon,
14+
igc-button,
15+
[igxButton] {
16+
--component-size: var(--ig-size, var(--ig-size-medium));
17+
}
18+
19+
@include e(message) {
20+
gap: rem(8px);
21+
padding: initial;
22+
}
23+
}

0 commit comments

Comments
 (0)