Skip to content

Commit

Permalink
fix: move toast buttons style condition to toast component
Browse files Browse the repository at this point in the history
  • Loading branch information
tutkli committed Mar 7, 2024
1 parent b5e199d commit 1ca7986
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions libs/ngx-sonner/src/lib/toast.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const defaultClasses: ToastClassnames = {
<button
data-button
data-cancel
[style]="cancelButtonStyle()"
[style]="cancelButtonStyle() ?? toast().cancelButtonStyle ?? ''"
[class]="cn(classes().cancelButton, toast().classes?.cancelButton)"
(click)="onCancelClick()">
{{ cancel.label }}
Expand All @@ -191,7 +191,7 @@ const defaultClasses: ToastClassnames = {
@if (toast().action; as action) {
<button
data-button
[style]="actionButtonStyle()"
[style]="actionButtonStyle() ?? toast().actionButtonStyle ?? ''"
[class]="cn(classes().actionButton, toast().classes?.actionButton)"
(click)="onActionClick($event)">
{{ action.label }}
Expand Down
12 changes: 2 additions & 10 deletions libs/ngx-sonner/src/lib/toaster.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,8 @@ const GAP = 14;
[position]="position()"
[expandByDefault]="expand()"
[expanded]="expanded()"
[actionButtonStyle]="
toastOptions().actionButtonStyle ??
toast.actionButtonStyle ??
''
"
[cancelButtonStyle]="
toastOptions().cancelButtonStyle ??
toast.cancelButtonStyle ??
''
"
[actionButtonStyle]="toastOptions().actionButtonStyle"
[cancelButtonStyle]="toastOptions().cancelButtonStyle"
[class]="toastOptions().class ?? ''"
[descriptionClass]="toastOptions().descriptionClass ?? ''"
[classes]="toastOptions().classes ?? {}"
Expand Down

0 comments on commit 1ca7986

Please sign in to comment.