-
-
Notifications
You must be signed in to change notification settings - Fork 10
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 #39 from ngxpert/fix/icon-content
Fix/icon content
- Loading branch information
Showing
28 changed files
with
668 additions
and
272 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Add New Hot Toast Demo | ||
|
||
1. Clone the repo | ||
2. Add new demo to `src/app/features/playground/playground.ts` | ||
3. If new component is needed, add it to `src/app/features/playground/components` | ||
4. Run `npm run start:lib` | ||
5. Run `npm run start` | ||
6. Open `http://localhost:4200/playground` | ||
7. Verify that new demo is added and is working | ||
8. Stage your changes | ||
9. Commit your changes using `npm run commit` > Select `docs` | ||
10. Push your changes to the remote repo | ||
11. Create a PR |
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.
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
2 changes: 1 addition & 1 deletion
2
projects/ngxpert/hot-toast/src/lib/components/animated-icon/animated-icon.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,3 +1,3 @@ | ||
<div class="hot-toast-animated-icon" [style.color]="iconTheme?.primary"> | ||
<ng-content></ng-content> | ||
<ng-container *dynamicView="icon"></ng-container> | ||
</div> |
4 changes: 4 additions & 0 deletions
4
projects/ngxpert/hot-toast/src/lib/components/animated-icon/animated-icon.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 |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { IconTheme } from '../../hot-toast.model'; | ||
import { Content, DynamicViewDirective } from '@ngneat/overview'; | ||
|
||
@Component({ | ||
selector: 'hot-toast-animated-icon', | ||
templateUrl: './animated-icon.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [DynamicViewDirective], | ||
}) | ||
export class AnimatedIconComponent { | ||
@Input() iconTheme: IconTheme; | ||
@Input() icon: Content; | ||
} | ||
|
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
Empty file.
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,116 +1,16 @@ | ||
import { Component } from '@angular/core'; | ||
import { HotToastService } from '@ngxpert/hot-toast'; | ||
import { from, of } from 'rxjs'; | ||
import { catchError } from 'rxjs/operators'; | ||
import { NgClass } from '@angular/common'; | ||
// import { Dialog } from '@angular/cdk/dialog'; | ||
|
||
import { REPO_URL } from './core/constants'; | ||
import { RouterOutlet } from '@angular/router'; | ||
import { FooterComponent } from './sections/footer/footer.component'; | ||
import { ReverseOrderComponent } from './sections/reverse-order/reverse-order.component'; | ||
import { StackingComponent } from './sections/stacking/stacking.component'; | ||
import { PositionComponent } from './sections/position/position.component'; | ||
import { ExampleComponent } from './sections/example/example.component'; | ||
import { StepsComponent } from './sections/steps/steps.component'; | ||
import { FeaturesComponent } from './sections/features/features.component'; | ||
import { GroupingComponent } from './sections/grouping/grouping.component'; | ||
import { EmojiButtonComponent } from './shared/components/emoji-button/emoji-button.component'; | ||
// import { JumpToDialogComponent } from './shared/components/jump-to-dialog/jump-to-dialog.component'; | ||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'], | ||
imports: [ | ||
NgClass, | ||
FeaturesComponent, | ||
StepsComponent, | ||
ExampleComponent, | ||
PositionComponent, | ||
StackingComponent, | ||
GroupingComponent, | ||
ReverseOrderComponent, | ||
FooterComponent, | ||
EmojiButtonComponent, | ||
// JumpToDialogComponent, | ||
] | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
imports: [ | ||
// JumpToDialogComponent, | ||
RouterOutlet, | ||
FooterComponent, | ||
], | ||
}) | ||
export class AppComponent { | ||
readonly repoUrl = REPO_URL; | ||
isDialogOpen = false; | ||
|
||
constructor(private toast: HotToastService) // private dialog: Dialog | ||
{} | ||
|
||
// keyDownListener(ev: KeyboardEvent) { | ||
// const key = ev.key; | ||
// const element = document.querySelector('[data-keyboard-key="' + key.toUpperCase() + '"]'); | ||
// element.classList.add('active'); | ||
// } | ||
|
||
// keyUpListener(ev: KeyboardEvent) { | ||
// const key = ev.key; | ||
// const element = document.querySelector('[data-keyboard-key="' + key.toUpperCase() + '"]'); | ||
// element.classList.remove('active'); | ||
// if (key === '/') { | ||
// ev.preventDefault(); | ||
// this.openDialog(); | ||
// } | ||
// } | ||
|
||
// ngOnInit() { | ||
// document.addEventListener('keyup', this.keyUpListener); | ||
// document.addEventListener('keydown', this.keyDownListener); | ||
// } | ||
|
||
// ngOnDestroy() { | ||
// document.removeEventListener('keyup', this.keyUpListener); | ||
// document.removeEventListener('keydown', this.keyDownListener); | ||
// } | ||
|
||
// openDialog() { | ||
// if (!this.isDialogOpen) { | ||
// this.isDialogOpen = true; | ||
|
||
// const dialogRef = this.dialog.open<string>(JumpToDialogComponent, { | ||
// width: '350px', | ||
// }); | ||
|
||
// dialogRef.closed.subscribe((result) => { | ||
// this.isDialogOpen = false; | ||
// }); | ||
// } | ||
// } | ||
|
||
observe() { | ||
const promise = new Promise((res, rej) => { | ||
if (Math.random() < 0.85) { | ||
setTimeout(res, 2000); | ||
} else { | ||
setTimeout(rej, 2000); | ||
} | ||
}); | ||
from(promise) | ||
.pipe( | ||
this.toast.observe({ | ||
loading: { content: 'Preparing toast', style: { width: '200px' } }, | ||
error: { content: 'Whoops, it burnt', style: { width: '200px' } }, | ||
success: { content: `Here's your toast`, style: { width: '200px' } }, | ||
}), | ||
catchError((error) => of(error)) | ||
) | ||
.subscribe(); | ||
} | ||
} | ||
|
||
@Component({ | ||
selector: 'app-icon', | ||
template: '✋', | ||
standalone: true, | ||
}) | ||
export class IconComponent {} | ||
@Component({ | ||
selector: 'app-msg', | ||
template: 'Hey, how are you?', | ||
standalone: true, | ||
}) | ||
export class MessageComponent {} |
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,8 @@ | ||
import { Routes } from '@angular/router'; | ||
import { PlaygroundComponent } from './features/playground/playground.component'; | ||
import { HomeComponent } from './features/home/home.component'; | ||
|
||
export const routes: Routes = [ | ||
{ path: '', component: HomeComponent }, | ||
{ path: 'playground', component: PlaygroundComponent }, | ||
]; |
Oops, something went wrong.