From 874f47d6e6eeb6bdefa7fd170ead6a2f8c45436a Mon Sep 17 00:00:00 2001 From: Clara Castillo Date: Fri, 23 Aug 2024 20:58:07 +0200 Subject: [PATCH] fix: prioritize toast position over toaster's --- libs/ngx-sonner/src/lib/toast.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ngx-sonner/src/lib/toast.component.ts b/libs/ngx-sonner/src/lib/toast.component.ts index ad6a0df..7c470da 100644 --- a/libs/ngx-sonner/src/lib/toast.component.ts +++ b/libs/ngx-sonner/src/lib/toast.component.ts @@ -230,6 +230,7 @@ export class ToastComponent implements AfterViewInit, OnDestroy { isVisible = computed(() => this.index() + 1 <= this.visibleToasts()); toastType = computed(() => this.toast().type ?? 'default'); toastClass = computed(() => this.toast().class ?? ''); + toastPosition = computed(() => this.toast().position ?? this.position()); toastDescriptionClass = computed(() => this.toast().descriptionClass ?? ''); heightIndex = computed(() => @@ -242,7 +243,7 @@ export class ToastComponent implements AfterViewInit, OnDestroy { lastCloseTimerStartTimeRef = 0; pointerStartRef: { x: number; y: number } | null = null; - coords = computed(() => this.position().split('-')); + coords = computed(() => this.toastPosition().split('-')); toastsHeightBefore = computed(() => this.heights().reduce((prev, curr, reducerIndex) => { if (reducerIndex >= this.heightIndex()) return prev;