Skip to content

Commit 88ca983

Browse files
authored
Revert "removing the dark theme switch"
1 parent baab7bd commit 88ca983

7 files changed

Lines changed: 49 additions & 1 deletion

File tree

projects/app-lob/src/app/grid-finjs/controllers.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<div class="controls-wrapper">
22
<div class="controls-holder">
33
<div class="switches">
4+
<div class="control-item">
5+
<igx-switch [checked]="false" [(ngModel)]="theme" (change)="onChange('theme', $event)">Dark</igx-switch>
6+
</div>
47
<div class="control-item">
58
<igx-switch [checked]="true" (change)="onChange('grouped', $event)" color="blue"
69
cssClass="finjs-sample-switch">

projects/app-lob/src/app/grid-finjs/controllers.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class ControllerComponent implements OnInit, OnDestroy {
2323
@Output() public playAction = new EventEmitter<{ action: string }>();
2424

2525
public volume = 1000;
26+
public theme = false;
2627
public frequency = 500;
2728
public controls = [
2829
{

projects/app-lob/src/app/grid-finjs/main.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="main__wrapper igx-scrollbar">
1+
<div class="main__wrapper igx-scrollbar" [class.fin-dark-theme]="darkTheme">
22
<app-finjs-controllers #controllers
33
(switchChanged)="onSwitchChanged($event)"
44
(volumeChanged)="onVolumeChanged($event)"

projects/app-lob/src/app/grid-finjs/main.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export class FinJSDemoComponent implements OnDestroy, AfterViewInit {
2222
closeOnOutsideClick: true
2323
};
2424

25+
@HostBinding('class.dark-theme')
26+
public darkTheme = false;
27+
2528
public properties = ['price', 'country'];
2629
public chartData: Stock[] = [];
2730
public volume = 1000;
@@ -38,6 +41,10 @@ export class FinJSDemoComponent implements OnDestroy, AfterViewInit {
3841
this.finGrid.toggleGrouping();
3942
break;
4043
}
44+
case 'theme': {
45+
this.darkTheme = event.value;
46+
break;
47+
}
4148
default: break;
4249
}
4350
}

projects/app-lob/src/app/treegrid-finjs/tree-grid-finjs-sample.component.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
@use '../../variables' as *;
22

33
:host ::ng-deep {
4+
.fin-dark-theme {
5+
.finjs-slider,
6+
.sample-toolbar,
7+
.group-drop-area {
8+
color: contrast-color(null, 'gray', 900);
9+
}
10+
11+
.group-drop-area {
12+
background: color(null, 'surface', 500);
13+
}
14+
}
15+
416
.finjs-icons {
517
display: flex;
618
align-items: center;

projects/app-lob/src/app/treegrid-finjs/tree-grid-finjs-sample.component.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export class TreeGridFinJSComponent implements OnDestroy, OnInit {
2121
@ViewChild('slider2', { static: true }) public intervalSlider!: IgxSliderComponent;
2222
@ViewChild(IgxOverlayOutletDirective, { static: true }) public outlet!: IgxOverlayOutletDirective;
2323

24+
@HostBinding('class.dark-theme')
25+
public theme = false;
26+
2427
public showToolbar = true;
2528
public selectionMode = 'multiple';
2629
public volume = 1000;
@@ -159,6 +162,19 @@ export class TreeGridFinJSComponent implements OnDestroy, OnInit {
159162
return value ? '$' + value.toFixed(3) : '';
160163
}
161164

165+
/**
166+
* the below code is needed when accessing the sample through the navigation
167+
* it will style all the space below the sample component element, but not the navigation menu
168+
*/
169+
public onThemeChanged(event: any) {
170+
const parentEl = this.parentComponentEl();
171+
if (event.checked && parentEl.classList.contains('main')) {
172+
parentEl.classList.add('fin-dark-theme');
173+
} else {
174+
parentEl.classList.remove('fin-dark-theme');
175+
}
176+
}
177+
162178
public ngOnDestroy() {
163179
this.stopFeed();
164180
}

src/styles.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ body {
3636
@include fluent-dark-theme($fluent-excel-palette);
3737
}
3838
}
39+
40+
.fin-dark-theme {
41+
@include dark-theme($green-palette);
42+
background: #333;
43+
44+
::-moz-placeholder {
45+
opacity: 1;
46+
}
47+
}

0 commit comments

Comments
 (0)