Skip to content

Commit 432614d

Browse files
author
ci-bot
committed
fix stying
1 parent 7be253f commit 432614d

File tree

3 files changed

+68
-8
lines changed

3 files changed

+68
-8
lines changed

apps/remix-ide/src/app/plugins/notification.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class NotificationPlugin extends Plugin implements MethodApi<INotificatio
4444

4545
async toast(message: string | JSX.Element, timeout?: number, timestamp?: number): Promise<number> {
4646
timestamp = timestamp || Date.now()
47+
timestamp = timestamp + ++this.toastId
4748
this.dispatcher.toast(message, timeout, timestamp)
4849
return timestamp
4950
}

libs/remix-ui/toaster/src/lib/toaster.css

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Sonner toast styling */
22
.remixui_sonner_toast {
33
border-radius: 8px;
4-
padding: 20px 28px;
4+
padding: 20px 48px 20px 28px;
55
font-weight: 700 !important;
66
font-size: 19px !important;
77
min-width: 350px;
@@ -45,7 +45,6 @@
4545

4646
[data-sonner-toast]:hover {
4747
transform: none !important;
48-
scale: 1 !important;
4948
}
5049

5150
[data-sonner-toast][data-styled="true"] {
@@ -87,7 +86,6 @@
8786
[data-sonner-toast] [data-close-button]:hover {
8887
opacity: 1;
8988
background: rgba(0, 0, 0, 0.05) !important;
90-
transform: scale(1.1);
9189
}
9290

9391
[data-sonner-toast] [data-close-button] svg {
@@ -105,3 +103,40 @@
105103
.dark [data-sonner-toast] [data-close-button]:hover {
106104
background: rgba(255, 255, 255, 0.1) !important;
107105
}
106+
107+
/* Custom codicon close button styling */
108+
[data-sonner-toast] .codicon-close {
109+
position: absolute;
110+
top: 12px;
111+
right: 12px;
112+
background: transparent !important;
113+
border: none;
114+
color: var(--bs-dark, #212529) !important;
115+
opacity: 0.7;
116+
cursor: pointer;
117+
padding: 4px;
118+
display: flex;
119+
align-items: center;
120+
justify-content: center;
121+
border-radius: 4px;
122+
transition: all 0.2s ease;
123+
width: 24px;
124+
height: 24px;
125+
z-index: 1;
126+
}
127+
128+
[data-sonner-toast] .codicon-close:hover {
129+
opacity: 1;
130+
background: rgba(0, 0, 0, 0.05) !important;
131+
}
132+
133+
/* Dark theme codicon close button */
134+
[data-sonner-toast][data-theme="dark"] .codicon-close,
135+
.dark [data-sonner-toast] .codicon-close {
136+
color: var(--bs-light, #f8f9fa) !important;
137+
}
138+
139+
[data-sonner-toast][data-theme="dark"] .codicon-close:hover,
140+
.dark [data-sonner-toast] .codicon-close:hover {
141+
background: rgba(255, 255, 255, 0.1) !important;
142+
}

libs/remix-ui/toaster/src/lib/toaster.tsx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,22 @@ export const ToastTrigger = (props: ToasterProps) => {
3131

3232
// Show toast using Sonner - Sonner handles deduplication via ID automatically
3333
const duration = props.timeout || 2000
34-
const showCloseButton = duration > 5000
34+
const showCloseButton = duration > 2000
3535
const showLoadingIcon = duration > 2000
3636

3737
if (typeof props.message === 'string') {
3838
const toastId = toast.custom(
3939
() => (
4040
<div>
4141
{showLoadingIcon && (
42-
<span className="spinner-border spinner-border-sm me-2" role="status">
42+
<span className="spinner-border spinner-border-sm me-2 alert-info" role="status">
4343
<span className="visually-hidden">Loading...</span>
4444
</span>
4545
)}
46+
{showCloseButton && (
47+
<span className="codicon codicon-close" onClick={() => toast.dismiss(toastId)} role="status">
48+
</span>
49+
)}
4650
{props.message}
4751
</div>
4852
),
@@ -59,16 +63,24 @@ export const ToastTrigger = (props: ToasterProps) => {
5963
}
6064
}
6165
)
66+
// Call the callback with the toast ID so caller can dismiss it later
67+
if (props.onToastCreated) {
68+
props.onToastCreated(toastId)
69+
}
6270
} else {
6371
// For JSX elements, use toast.custom
6472
const toastId = toast.custom(
6573
() => (
6674
<div>
6775
{showLoadingIcon && (
68-
<span className="spinner-border spinner-border-sm me-2" role="status">
76+
<span className="spinner-border spinner-border-sm me-2 alert-info" role="status">
6977
<span className="visually-hidden">Loading...</span>
7078
</span>
7179
)}
80+
{showCloseButton && (
81+
<span className="codicon codicon-close" onClick={() => toast.dismiss(toastId)} role="status">
82+
</span>
83+
)}
7284
{props.message}
7385
</div>
7486
),
@@ -84,6 +96,10 @@ export const ToastTrigger = (props: ToasterProps) => {
8496
}
8597
}
8698
)
99+
// Call the callback with the toast ID so caller can dismiss it later
100+
if (props.onToastCreated) {
101+
props.onToastCreated(toastId)
102+
}
87103
}
88104
}
89105
}, [])
@@ -130,10 +146,14 @@ export const Toaster = (props: ToasterProps) => {
130146
() => (
131147
<div className="remixui_sonner_toast alert alert-info bg-light">
132148
{showLoadingIcon && (
133-
<span className="spinner-border spinner-border-sm me-2" role="status">
149+
<span className="spinner-border spinner-border-sm me-2 alert-info" role="status">
134150
<span className="visually-hidden">Loading...</span>
135151
</span>
136152
)}
153+
{showCloseButton && (
154+
<span className="codicon codicon-close" onClick={() => toast.dismiss(toastId)} role="status">
155+
</span>
156+
)}
137157
{props.message}
138158
</div>
139159
),
@@ -156,10 +176,14 @@ export const Toaster = (props: ToasterProps) => {
156176
() => (
157177
<div className="remixui_sonner_toast alert alert-info bg-light">
158178
{showLoadingIcon && (
159-
<span className="spinner-border spinner-border-sm me-2" role="status">
179+
<span className="spinner-border spinner-border-sm me-2 alert-info" role="status">
160180
<span className="visually-hidden">Loading...</span>
161181
</span>
162182
)}
183+
{showCloseButton && (
184+
<span className="codicon codicon-close" onClick={() => toast.dismiss(toastId)} role="status">
185+
</span>
186+
)}
163187
{props.message}
164188
</div>
165189
),

0 commit comments

Comments
 (0)