Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding animates options for toasty #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions src/app/toast/toast.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ import {ToastCommunicationService} from './toast-communication.service';

<label for="timeout">Timeout</label>
<input type="text" class="u-full-width" id="timeout" [(ngModel)]="options.timeout" placeholder="5000" name="timeout"/>

<label for="theme">Animate</label>
<select class="u-full-width" [(ngModel)]="options.animate" name="animate">
<option *ngFor="let animate of animates" [value]="animate.code">{{animate.name}}</option>
</select>
</div>
<div class="four columns">
<label for="showclose">Show Close Icon</label>
Expand All @@ -53,7 +58,8 @@ import {ToastCommunicationService} from './toast-communication.service';
msg: "{{ options.msg }}",
showClose: {{ options.showClose }},
timeout: {{ options.timeout || false }},
theme: "{{ options.theme }}"
theme: "{{ options.theme }}",
animate: "{{ options.animate }}"
{{ '}' }});
</code>
<code>toastyConfig({{ '{' }}
Expand Down Expand Up @@ -84,6 +90,23 @@ export class ToastComponent {
code: 'bootstrap'
}];

animates = [{
name: 'From Right',
code: 'fromRight'
}, {
name: 'From Left',
code: 'fromLeft'
}, {
name: 'Scale',
code: 'scale'
}, {
name: 'Rotate',
code: 'rotate'
}, {
name: 'None',
code: 'none'
}];

types = [{
name: 'Default',
code: 'default',
Expand Down Expand Up @@ -135,7 +158,8 @@ export class ToastComponent {
showClose: true,
timeout: 5000,
theme: this.themes[0].code,
type: this.types[0].code
type: this.types[0].code,
animate: this.animates[0].code
};

getTitle(num: number): string {
Expand All @@ -155,6 +179,7 @@ export class ToastComponent {
showClose: this.options.showClose,
timeout: this.options.timeout,
theme: this.options.theme,
animate: this.options.animate,
// position: this.options.position,
onAdd: (toast: ToastData) => {
console.log('Toast ' + toast.id + ' has been added!');
Expand Down