import { Component, Inject, OnInit } from '@angular/core';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
import { NanoDialogBase } from '../nano-base-dialog';

export interface DialogData {
  name: string;
}

@Component({
  selector: 'app-new-folder-dialog',
  templateUrl: './new-folder-dialog.component.html',
  styleUrls: ['./new-folder-dialog.component.scss']
})
export class NewFolderDialogComponent extends NanoDialogBase<NewFolderDialogComponent> implements OnInit {

  constructor(
    public dialogRef: MatDialogRef<NewFolderDialogComponent>,
    @Inject(MAT_DIALOG_DATA) public data: DialogData) {
      super(dialogRef);
    }

  onCancel(): void {
    this.dialogRef.close();
  }

  ngOnInit(): void {
  }

  onSubmit(){
    if (this.data.name.length > 0){
      this.dialogRef.close(this.data.name);
    }
  }

}
