Skip to content

Commit a46976d

Browse files
0ubbeAbhi1992002
andauthored
fix(frontend): allow to close toasts (#11550)
## Changes 🏗️ <img width="795" height="275" alt="Screenshot 2025-12-04 at 21 05 55" src="https://github.com/user-attachments/assets/e7572635-3976-4822-89ea-3e5e26196ab8" /> Allow to close toasts 🍞 ## Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Run Storybook locally - [x] Toast have a close button top-right --------- Co-authored-by: Abhimanyu Yadav <[email protected]>
1 parent 8be3c88 commit a46976d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

autogpt_platform/frontend/src/components/molecules/Toast/styles.module.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ html body .toastDescription {
3737
font-size: 0.75rem !important;
3838
line-height: 1.25rem !important;
3939
}
40+
41+
/* Position close button on the right */
42+
/* stylelint-disable-next-line selector-pseudo-class-no-unknown */
43+
#root [data-sonner-toast] [data-close-button="true"] {
44+
left: unset !important;
45+
right: -18px !important;
46+
top: -3px !important;
47+
}

autogpt_platform/frontend/src/components/molecules/Toast/toaster.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
"use client";
22

3+
import { CheckCircle, Info, Warning, XCircle } from "@phosphor-icons/react";
34
import { Toaster as SonnerToaster } from "sonner";
4-
import { CheckCircle, XCircle, Warning, Info } from "@phosphor-icons/react";
55
import styles from "./styles.module.css";
66

77
export function Toaster() {
88
return (
99
<SonnerToaster
1010
position="bottom-center"
1111
richColors
12+
closeButton
1213
toastOptions={{
1314
classNames: {
1415
toast: styles.toastDefault,
@@ -20,6 +21,7 @@ export function Toaster() {
2021
info: styles.toastInfo,
2122
},
2223
}}
24+
className="custom__toast"
2325
icons={{
2426
success: <CheckCircle className="h-4 w-4" color="#fff" weight="fill" />,
2527
error: <XCircle className="h-4 w-4" color="#fff" weight="fill" />,

0 commit comments

Comments
 (0)