11import { Component , h , Method , State } from '@stencil/core' ;
2+ import { Icon } from 'common/Icon' ;
3+ import { IconNamesEnum } from 'common/Icon/icon.types' ;
24import { ConnectionMonitor } from 'utils/ConnectionMonitor' ;
35import type { IEventBus } from 'utils/EventBus' ;
46import { EventBus } from 'utils/EventBus' ;
@@ -18,6 +20,7 @@ export class ToastList {
1820 @State ( ) transactionToasts : ITransactionToast [ ] = [ ] ;
1921 @State ( ) customToasts : CustomToastType [ ] = [ ] ;
2022 @State ( ) isVisible : boolean = true ;
23+ @State ( ) isMinimized : boolean = false ;
2124
2225 @Method ( )
2326 async getEventBus ( ) {
@@ -80,24 +83,40 @@ export class ToastList {
8083 this . customToasts = [ ...payload ] ;
8184 } ;
8285
86+ private readonly toggleMinimize = ( ) => {
87+ this . isMinimized = ! this . isMinimized ;
88+ } ;
89+
8390 private resetState ( ) {
8491 this . transactionToasts = [ ] ;
8592 this . customToasts = [ ] ;
8693 this . isVisible = true ;
94+ this . isMinimized = false ;
8795 }
8896
8997 render ( ) {
9098 const hasTransactionToasts = this . transactionToasts ?. length > 0 ;
9199
100+ const toastListClasses = {
101+ 'toast-list' : true ,
102+ 'toast-list-bottom' : hasTransactionToasts ,
103+ 'hidden' : ! this . isVisible ,
104+ } ;
105+
106+ if ( this . isMinimized && hasTransactionToasts ) {
107+ return (
108+ < div class = { toastListClasses } id = "toast-list" >
109+ < div class = "view-all-button-container" >
110+ < button class = "maximize-button" onClick = { this . toggleMinimize } aria-label = "Maximize Toasts" >
111+ < Icon name = { IconNamesEnum . maximize } />
112+ </ button >
113+ </ div >
114+ </ div >
115+ ) ;
116+ }
117+
92118 return (
93- < div
94- class = { {
95- 'toast-list' : true ,
96- 'toast-list-bottom' : hasTransactionToasts ,
97- 'hidden' : ! this . isVisible ,
98- } }
99- id = "toast-list"
100- >
119+ < div class = { toastListClasses } id = "toast-list" >
101120 { this . customToasts ?. map ( toast => (
102121 < mvx-generic-toast toast = { toast } onDeleteToast = { ( ) => this . handleCustomToastDelete ( toast . toastId ) } />
103122 ) ) }
@@ -108,6 +127,9 @@ export class ToastList {
108127
109128 { hasTransactionToasts && (
110129 < div class = "view-all-button-container" >
130+ < button class = "minimize-button" onClick = { this . toggleMinimize } aria-label = "Minimize Toasts" >
131+ < Icon name = { IconNamesEnum . minimize } />
132+ </ button >
111133 < button class = "view-all-button" onClick = { this . handleViewAllClick } >
112134 View All
113135 </ button >
0 commit comments