File tree Expand file tree Collapse file tree 3 files changed +22
-17
lines changed
app/entities/common/Toast Expand file tree Collapse file tree 3 files changed +22
-17
lines changed Original file line number Diff line number Diff line change @@ -9,27 +9,25 @@ interface ToastProps {
99const Toast = ( { message, type, removeToast } : ToastProps ) => {
1010 const iconRender = ( type : 'success' | 'error' ) => {
1111 if ( type === 'success' ) {
12- return < CiCircleCheck size = { 32 } /> ;
12+ return < CiCircleCheck color = { 'green' } size = { 40 } /> ;
1313 } else {
14- return < CiCircleRemove size = { 32 } /> ;
14+ return < CiCircleRemove color = { 'red' } size = { 40 } /> ;
1515 }
1616 } ;
17- const backgroundColor = type === 'success' ? 'bg-green-500' : 'bg-red-500' ;
18-
1917 return (
20- < div className = "fixed bottom-6 left-1/2 transform -translate-x-1/2 z-50 w-[90%] max-w-md" >
21- < div
22- className = { `
18+ < div
19+ onClick = { ( ) => removeToast ( ) }
20+ className = { `
2321 transform transition-all duration-300 ease-out animate-slideUp
24- bg-gray-200/90 text-black px-4 py-3 rounded-lg flex items-center gap-3
25- backdrop-blur-sm w-full max-w-md
22+ bg-gray-200/90 text-black px-3 py-2 rounded-lg flex items-center gap-3
23+ backdrop-blur-sm w-full max-w-md origin-center cursor-pointer
24+ hover:bg-gray-300/90 hover:shadow-lg
2625 ` }
27- >
28- < div className = { `${ backgroundColor } rounded-full p-0.5` } >
29- { iconRender ( type ) }
30- </ div >
31- < p className = "text whitespace-pre-line flex-1" > { message } </ p >
26+ >
27+ < div className = { `flex items-center justify-center rounded-full p-0.5` } >
28+ { iconRender ( type ) }
3229 </ div >
30+ < p className = "text line-clamp-1 whitespace-pre-line flex-1" > { message } </ p >
3331 </ div >
3432 ) ;
3533} ;
Original file line number Diff line number Diff line change @@ -11,9 +11,14 @@ interface Toast {
1111const ToastProvider = ( ) => {
1212 const { toasts, removeToast } = useToastStore ( ) ;
1313
14+ const reversedToasts = toasts . toReversed ( ) ;
1415 return (
15- < div className = { 'fixed z-50 flex flex-col gap-2 top-10 right-10' } >
16- { toasts . map ( ( toast : Toast ) => {
16+ < div
17+ className = {
18+ 'fixed bottom-6 left-1/2 transform -translate-x-1/2 flex flex-col gap-4 z-50 w-[90%] max-w-md'
19+ }
20+ >
21+ { reversedToasts . map ( ( toast : Toast ) => {
1722 return (
1823 < Toast
1924 key = { toast . id }
Original file line number Diff line number Diff line change @@ -39,11 +39,13 @@ const config: Config = {
3939 } ,
4040 slideUp : {
4141 '0%' : {
42- transform : 'translateY(100%)' ,
42+ transform : 'translateY(50%)' ,
43+ width : '20%' ,
4344 opacity : '0' ,
4445 } ,
4546 '100%' : {
4647 transform : 'translateY(0)' ,
48+ width : '100%' ,
4749 opacity : '1' ,
4850 } ,
4951 } ,
You can’t perform that action at this time.
0 commit comments