mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-17 17:31:27 +03:00
Added confirm dialog component to help with confirming actions
This commit is contained in:
12
src/app/dialogs/confirm-dialog/confirm-dialog.component.html
Normal file
12
src/app/dialogs/confirm-dialog/confirm-dialog.component.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<h4 mat-dialog-title>{{dialogTitle}}</h4>
|
||||||
|
<mat-dialog-content>
|
||||||
|
<div>
|
||||||
|
{{dialogText}}
|
||||||
|
</div>
|
||||||
|
</mat-dialog-content>
|
||||||
|
<mat-dialog-actions>
|
||||||
|
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
|
||||||
|
<button color="primary" mat-flat-button type="submit" [mat-dialog-close]="true">{{submitText}}</button>
|
||||||
|
<span class="spacer"></span>
|
||||||
|
<button style="float: right;" mat-stroked-button mat-dialog-close>Cancel</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.spacer {flex: 1 1 auto;}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ConfirmDialogComponent } from './confirm-dialog.component';
|
||||||
|
|
||||||
|
describe('ConfirmDialogComponent', () => {
|
||||||
|
let component: ConfirmDialogComponent;
|
||||||
|
let fixture: ComponentFixture<ConfirmDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ConfirmDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ConfirmDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
24
src/app/dialogs/confirm-dialog/confirm-dialog.component.ts
Normal file
24
src/app/dialogs/confirm-dialog/confirm-dialog.component.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-confirm-dialog',
|
||||||
|
templateUrl: './confirm-dialog.component.html',
|
||||||
|
styleUrls: ['./confirm-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class ConfirmDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
dialogTitle: 'Confirm';
|
||||||
|
dialogText: 'Would you like to confirm?';
|
||||||
|
submitText: 'Yes'
|
||||||
|
|
||||||
|
constructor(@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||||
|
if (this.data.dialogTitle) { this.dialogTitle = this.data.dialogTitle };
|
||||||
|
if (this.data.dialogText) { this.dialogText = this.data.dialogText };
|
||||||
|
if (this.data.submitText) { this.submitText = this.data.submitText };
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user