-
-
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.
Merge pull request #93 from js-smart/development
feat(progress-state): adds utility function to show loader
- Loading branch information
Showing
53 changed files
with
558 additions
and
412 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
projects/ngxsmart-demo/src/app/alert-demo/alert-demo.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
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
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
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
50 changes: 24 additions & 26 deletions
50
projects/ngxsmart-demo/src/app/autocomplete-demo/autocomplete-demo.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 |
---|---|---|
@@ -1,37 +1,35 @@ | ||
<h1 style="display: flex; justify-content: center; align-items: center;margin-top: 50px"> | ||
Generic Auto Complete (Works with Objects and Strings) | ||
<h1 style="display: flex; justify-content: center; align-items: center; margin-top: 50px"> | ||
Generic Auto Complete (Works with Objects and Strings) | ||
</h1> | ||
<div style="display: flex; justify-content: center; align-items: center; "> | ||
<form [formGroup]="genericFormGroup"> | ||
<autocomplete | ||
[data]="cities" | ||
[inputFormGroup]="genericFormGroup" | ||
[required]="true" | ||
bindLabel="location" | ||
bindValue="id" | ||
label="City" | ||
placeHolder="Select City"> | ||
</autocomplete> | ||
</form> | ||
<div style="display: flex; justify-content: center; align-items: center"> | ||
<form [formGroup]="genericFormGroup"> | ||
<autocomplete | ||
[data]="cities" | ||
[inputFormGroup]="genericFormGroup" | ||
[required]="true" | ||
bindLabel="location" | ||
bindValue="id" | ||
label="City" | ||
placeHolder="Select City"> | ||
</autocomplete> | ||
</form> | ||
</div> | ||
<div style="display: flex; justify-content: center; align-items: center; margin-top: 20px"> | ||
<p>Selected Option Is:</p> | ||
<h2>{{ genericFormGroup.get('autocomplete')?.value?.location ?? '' }}</h2> | ||
<p>Selected Option Is:</p> | ||
<h2>{{ genericFormGroup.get('autocomplete')?.value?.location ?? '' }}</h2> | ||
</div> | ||
<hr /> | ||
|
||
<hr /> | ||
|
||
<h2 style="display: flex; justify-content: center; align-items: center;margin-top: 50px">Auto Complete (Works with | ||
Strings)</h2> | ||
<div style="display: flex; justify-content: center; align-items: center; "> | ||
<form [formGroup]="stringInputFormGroup"> | ||
<autocomplete [data]="names" [inputFormGroup]="stringInputFormGroup" [required]="true" label="City" | ||
placeHolder="Select City"> | ||
</autocomplete> | ||
</form> | ||
<h2 style="display: flex; justify-content: center; align-items: center; margin-top: 50px">Auto Complete (Works with Strings)</h2> | ||
<div style="display: flex; justify-content: center; align-items: center"> | ||
<form [formGroup]="stringInputFormGroup"> | ||
<autocomplete [data]="names" [inputFormGroup]="stringInputFormGroup" [required]="true" label="City" placeHolder="Select City"> | ||
</autocomplete> | ||
</form> | ||
</div> | ||
<div style="display: flex; justify-content: center; align-items: center; margin-top: 20px"> | ||
<p>Selected Option Is:</p> | ||
<h2>{{ stringInputFormGroup.get('autocomplete')?.value ?? '' }}</h2> | ||
<p>Selected Option Is:</p> | ||
<h2>{{ stringInputFormGroup.get('autocomplete')?.value ?? '' }}</h2> | ||
</div> |
28 changes: 14 additions & 14 deletions
28
projects/ngxsmart-demo/src/app/buttons-demo/buttons-demo.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
11 changes: 11 additions & 0 deletions
11
projects/ngxsmart-demo/src/app/confirm-dialog-demo/confirm-dialog-demo.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,11 @@ | ||
<div class="m-5"> | ||
<primary-button label="Click to Confirm" (click)="confirm()"></primary-button> | ||
|
||
<br /> | ||
<br /> | ||
<section> | ||
<h3 class="mat-h3"> | ||
<b class="m-2">Confirm Status:</b>{{confirmStatus()}} | ||
</h3> | ||
</section> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
...art-demo/src/app/confirm-dialog-demo/confirm-dialog-demo.component.html-demo.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,32 @@ | ||
import { Component, inject, signal } from '@angular/core'; | ||
import { MatDialog } from '@angular/material/dialog'; | ||
import { ConfirmDialogComponent, PrimaryButtonComponent } from '@js-smart/ngxsmart'; | ||
|
||
@Component({ | ||
selector: 'ngxsmart-confirm-dialog-demo', | ||
standalone: true, | ||
templateUrl: './confirm-dialog-demo.component.html', | ||
styles: [``], | ||
imports: [ConfirmDialogComponent, PrimaryButtonComponent], | ||
}) | ||
export class ConfirmDialogDemoComponent { | ||
dialog = inject(MatDialog); | ||
confirmStatus = signal(''); | ||
confirm() { | ||
const ref = this.dialog.open(ConfirmDialogComponent, { | ||
data: { | ||
title: 'Confirm', | ||
message: 'Are you sure you want to do this?', | ||
}, | ||
}); | ||
|
||
// Listen for confirmation result | ||
ref.afterClosed().subscribe((status: boolean) => { | ||
if (status) { | ||
this.confirmStatus.set('Confirmed'); | ||
} else { | ||
this.confirmStatus.set('Canceled'); | ||
} | ||
}); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
projects/ngxsmart-demo/src/app/progress-state-demo/progress-state-demo.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,12 @@ | ||
<div class="custom-flex-justify-center"> | ||
<save-primary-button (click)="setLoading()" [loading]="updateState().isLoading" class="m-3" label="Save Data"></save-primary-button> | ||
</div> | ||
<p style="margin: 1rem"> | ||
<alert *ngIf="updateState().isSuccess && !updateState().isLoading" type="success" [dismissible]="true"> | ||
<strong>Success!</strong> Your data has been saved. | ||
</alert> | ||
|
||
<alert *ngIf="updateState().isError && !updateState().isLoading" type="danger" [dismissible]="true"> | ||
<strong>Failure!</strong> Your data has not been saved. | ||
</alert> | ||
</p> |
21 changes: 21 additions & 0 deletions
21
projects/ngxsmart-demo/src/app/progress-state-demo/progress-state-demo.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,21 @@ | ||
import { Component } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { AlertComponent, initializeState, markLoading, markSuccess, SavePrimaryButtonComponent } from '@js-smart/ngxsmart'; | ||
|
||
@Component({ | ||
selector: 'app-progress-state-demo', | ||
standalone: true, | ||
imports: [CommonModule, SavePrimaryButtonComponent, AlertComponent], | ||
templateUrl: './progress-state-demo.component.html', | ||
}) | ||
export class ProgressStateDemoComponent { | ||
updateState = initializeState(); | ||
|
||
setLoading() { | ||
markLoading(this.updateState); | ||
|
||
setTimeout(() => { | ||
markSuccess(this.updateState, 'Successfully saved data'); | ||
}, 2000); | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
|
||
.success-snackbar { | ||
color: white; | ||
--mdc-snackbar-container-color: var(--success-color); | ||
--mat-mdc-snack-bar-button-color: var(--white-color); | ||
color: white; | ||
--mdc-snackbar-container-color: var(--success-color); | ||
--mat-mdc-snack-bar-button-color: var(--white-color); | ||
} | ||
|
||
.error-snackbar { | ||
color: white; | ||
--mdc-snackbar-container-color: var(--delete-color); | ||
--mat-mdc-snack-bar-button-color: var(--white-color); | ||
color: white; | ||
--mdc-snackbar-container-color: var(--delete-color); | ||
--mat-mdc-snack-bar-button-color: var(--white-color); | ||
} | ||
|
||
.light-success-snackbar { | ||
color: #155724; | ||
background-color: #d4edda; | ||
--mdc-snackbar-container-color: #d4edda; | ||
--mat-mdc-snack-bar-button-color: darkgreen; | ||
color: #155724; | ||
background-color: #d4edda; | ||
--mdc-snackbar-container-color: #d4edda; | ||
--mat-mdc-snack-bar-button-color: darkgreen; | ||
} | ||
|
||
.light-error-snackbar { | ||
color: #721c24; | ||
--mdc-snackbar-container-color: var(--success-color); | ||
--mat-mdc-snack-bar-button-color: darkred; | ||
border-color: #f5c6cb; | ||
} | ||
color: #721c24; | ||
--mdc-snackbar-container-color: var(--success-color); | ||
--mat-mdc-snack-bar-button-color: darkred; | ||
border-color: #f5c6cb; | ||
} |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
:root { | ||
--primary-color: #153d77; | ||
--secondary-color: #6c757d; | ||
--white-color: #fff; | ||
--success-color: #198754; | ||
--delete-color: #dc3545; | ||
--background-color: #f2f2f2; | ||
--primary-color: #153d77; | ||
--secondary-color: #6c757d; | ||
--white-color: #fff; | ||
--success-color: #198754; | ||
--delete-color: #dc3545; | ||
--background-color: #f2f2f2; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
|
Oops, something went wrong.