-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86c9e3b
commit adcb2fd
Showing
4 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...rc/app/file-items/shared/dialogs/edit-file-item-modal/edit-file-item-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<h2 mat-dialog-title>{{ name() ? "Edit Folder" : "Create Folder" }}</h2> | ||
<mat-dialog-content class="dialog-content"> | ||
@if (action() !== EnFileAction.ChangeColor) { | ||
<mat-form-field> | ||
<mat-label>Name</mat-label> | ||
<input matInput [(ngModel)]="name" /> | ||
@if (action() !== EnFileAction.Rename) { | ||
<mat-icon matSuffix (click)="$event.stopPropagation(); testIt()" | ||
>palette</mat-icon | ||
> | ||
} | ||
</mat-form-field> | ||
} | ||
</mat-dialog-content> | ||
<mat-dialog-actions> | ||
<button mat-button (click)="onCancel()">Cancel</button> | ||
<button mat-button [mat-dialog-close]="[name(), color()]" cdkFocusInitial> | ||
Ok | ||
</button> | ||
</mat-dialog-actions> |
4 changes: 4 additions & 0 deletions
4
...rc/app/file-items/shared/dialogs/edit-file-item-modal/edit-file-item-modal.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.dialog-content { | ||
display: flex; | ||
flex-direction: column; | ||
} |
28 changes: 28 additions & 0 deletions
28
...app/file-items/shared/dialogs/edit-file-item-modal/edit-file-item-modal.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* tslint:disable:no-unused-variable */ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { By } from '@angular/platform-browser'; | ||
import { DebugElement } from '@angular/core'; | ||
|
||
import { EditFileItemModalComponent } from './edit-file-item-modal.component'; | ||
|
||
describe('EditFileItemModalComponent', () => { | ||
let component: EditFileItemModalComponent; | ||
let fixture: ComponentFixture<EditFileItemModalComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ EditFileItemModalComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(EditFileItemModalComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
53 changes: 53 additions & 0 deletions
53
.../src/app/file-items/shared/dialogs/edit-file-item-modal/edit-file-item-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Component, inject, model, OnInit } from '@angular/core'; | ||
import { | ||
MAT_DIALOG_DATA, | ||
MatDialogActions, | ||
MatDialogClose, | ||
MatDialogContent, | ||
MatDialogRef, | ||
MatDialogTitle, | ||
} from '@angular/material/dialog'; | ||
import { MatFormFieldModule } from '@angular/material/form-field'; | ||
import { MatInputModule } from '@angular/material/input'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { FileItemEditModel } from '../../file-item-edit.model'; | ||
import { EnFileAction } from '../../file-action-type.enum'; | ||
|
||
@Component({ | ||
selector: 'fs-edit-file-item-modal', | ||
templateUrl: './edit-file-item-modal.component.html', | ||
styleUrl: './edit-file-item-modal.component.scss', | ||
standalone: true, | ||
imports: [ | ||
MatFormFieldModule, | ||
MatInputModule, | ||
FormsModule, | ||
MatButtonModule, | ||
MatIconModule, | ||
MatDialogTitle, | ||
MatDialogContent, | ||
MatDialogActions, | ||
MatDialogClose, | ||
], | ||
}) | ||
export class EditFileItemModalComponent implements OnInit { | ||
readonly dialogRef = inject(MatDialogRef<EditFileItemModalComponent>); | ||
readonly data = inject<FileItemEditModel>(MAT_DIALOG_DATA); | ||
readonly name = model(this.data.name); | ||
readonly color = model(this.data.color); | ||
readonly action = model(this.data.action); | ||
|
||
EnFileAction = EnFileAction; | ||
|
||
constructor() {} | ||
|
||
ngOnInit() {} | ||
|
||
testIt() {} | ||
|
||
onCancel(): void { | ||
this.dialogRef.close(); | ||
} | ||
} |