File

src/app/dialogs/settings-dialog/settings-dialog.component.ts

Metadata

selector app-settings-dialog
styleUrls ./settings-dialog.component.scss
templateUrl ./settings-dialog.component.html

Index

Properties
Methods

Constructor

constructor(dialogRef: MatDialogRef<SettingsDialogComponent | boolean>, dialog: MatDialog)
Parameters :
Name Type Optional
dialogRef MatDialogRef<SettingsDialogComponent | boolean> No
dialog MatDialog No

Methods

Public openAccessTokenSettings
openAccessTokenSettings()
Returns : void
Public openProfileSettings
openProfileSettings()
Returns : void
Public switchTheme
switchTheme()
Returns : void

Properties

Public dialogRef
Type : MatDialogRef<SettingsDialogComponent | boolean>
mode
Type : string
Default value : 'Dark Mode'
modeIcon
Type : string
Default value : 'dark_mode'
import {Component} from '@angular/core';
import {MatDialogRef} from '@angular/material/dialog';
import {MatDialog} from '@angular/material/dialog';
import {ProfileSettingsDialogComponent} from '../profile-settings-dialog/profile-settings-dialog.component';
import {AccessTokenDialogComponent} from '../access-token-dialog/access-token-dialog.component';

@Component({
  selector: 'app-settings-dialog',
  templateUrl: './settings-dialog.component.html',
  styleUrls: ['./settings-dialog.component.scss']
})
export class SettingsDialogComponent {
  mode = 'Dark Mode';
  modeIcon = 'dark_mode';

  constructor(public dialogRef: MatDialogRef<SettingsDialogComponent, boolean>, private dialog: MatDialog) {}

  //open the dialog with profile settings
  public openProfileSettings(): void {
    this.dialogRef.close();
    this.dialog.open(ProfileSettingsDialogComponent);
  }

  //open the dialog with access token settings
  public openAccessTokenSettings(): void {
    this.dialogRef.close();
    this.dialog.open(AccessTokenDialogComponent);
  }

  //switch to dark mode / light mode (TODO)
  public switchTheme(): void {
    if (this.mode === 'Light Mode') {
      this.mode = 'Dark Mode';
    } else {
      this.mode = 'Light Mode';
    }

    if (this.modeIcon === 'light_mode') {
      this.modeIcon = 'dark_mode';
    } else {
      this.modeIcon = 'light_mode';
    }
  }
}
<h1 mat-dialog-title style="text-align: center">Settings</h1>
<mat-list>
  <div>
    <button class="button" mat-flat-button (click)="this.openProfileSettings()">
      <mat-icon>
        <span class="material-icons-outlined"> account_circle </span>
      </mat-icon>
      Profile Settings
    </button>
  </div>
  <div>
    <button class="button" mat-flat-button (click)="this.openAccessTokenSettings()">
      <mat-icon> <span class="material-icons-outlined"> token </span></mat-icon>
      Access Token
    </button>
  </div>
  <div>
    <button class="button" mat-flat-button (click)="this.switchTheme()">
      <mat-icon> <span class="material-icons-outlined"> {{ modeIcon }} </span></mat-icon>
      {{ mode }}
    </button>
  </div>
</mat-list>

./settings-dialog.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""