Skip to content

Commit 4f0acd2

Browse files
authored
Merge pull request #3200 from IgniteUI/snovoselski/add-hide-theme-switch-finjs-vnext
fix(finjs): add option to hide theme widget
2 parents d61b94c + 540d1f9 commit 4f0acd2

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="controls-wrapper">
22
<div class="controls-holder">
33
<div class="switches">
4-
<div class="control-item">
4+
<div class="control-item" *ngIf="isThemeSwitchVisible">
55
<igx-switch [checked]="false" [(ngModel)]="theme" (change)="onChange('theme', $event)">Dark</igx-switch>
66
</div>
77
<div class="control-item">

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core';
2+
import { ActivatedRoute } from '@angular/router';
23
import {
34
IButtonGroupEventArgs, IChangeSwitchEventArgs, IgxButtonGroupComponent,
45
IgxSliderComponent, IgxToastComponent, ISliderValueChangeEventArgs, VerticalAlignment }
@@ -24,6 +25,7 @@ export class ControllerComponent implements OnInit, OnDestroy {
2425

2526
public volume = 1000;
2627
public theme = false;
28+
public isThemeSwitchVisible = true;
2729
public frequency = 500;
2830
public controls = [
2931
{
@@ -52,6 +54,8 @@ export class ControllerComponent implements OnInit, OnDestroy {
5254
private frequencyChanged$: Observable<ISliderValueChangeEventArgs>;
5355
private frequencyChangedSubscription: Subscription;
5456

57+
constructor(private router: ActivatedRoute) {}
58+
5559
public ngOnInit(): void {
5660
this.volumeChanged$ = this.volumeSlider.valueChange.pipe(debounce(() => timer(200)));
5761
this.volumeChangedSubscription = this.volumeChanged$.subscribe(x => this.volumeChanged.emit(this.volumeSlider.value as number));
@@ -61,6 +65,11 @@ export class ControllerComponent implements OnInit, OnDestroy {
6165
.subscribe(() => this.frequencyChanged.emit(this.intervalSlider.value as number));
6266

6367
this.toast.positionSettings.verticalDirection = VerticalAlignment.Middle;
68+
69+
// Hide theme switcher
70+
if (this.router.snapshot.queryParamMap.get('theme-switch') === 'false') {
71+
this.isThemeSwitchVisible = false;
72+
}
6473
}
6574

6675
public ngOnDestroy(): void {

0 commit comments

Comments
 (0)