Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): allow to close toasts (#11550)

Ubbea46976decd0f
diff --git a/autogpt_platform/frontend/src/components/molecules/Toast/styles.module.css b/autogpt_platform/frontend/src/components/molecules/Toast/styles.module.css
index d1daaaa88b..ec8271958f 100644
--- a/autogpt_platform/frontend/src/components/molecules/Toast/styles.module.css
+++ b/autogpt_platform/frontend/src/components/molecules/Toast/styles.module.css
@@ -37,3 +37,11 @@ html body .toastDescription {
font-size: 0.75rem !important;
line-height: 1.25rem !important;
}
+
+/* Position close button on the right */
+/* stylelint-disable-next-line selector-pseudo-class-no-unknown */
+#root [data-sonner-toast] [data-close-button="true"] {
+ left: unset !important;
+ right: -18px !important;
+ top: -3px !important;
+}
diff --git a/autogpt_platform/frontend/src/components/molecules/Toast/toaster.tsx b/autogpt_platform/frontend/src/components/molecules/Toast/toaster.tsx
index d99ef37b07..adb88831af 100644
--- a/autogpt_platform/frontend/src/components/molecules/Toast/toaster.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/Toast/toaster.tsx
@@ -1,7 +1,7 @@
"use client";
+import { CheckCircle, Info, Warning, XCircle } from "@phosphor-icons/react";
import { Toaster as SonnerToaster } from "sonner";
-import { CheckCircle, XCircle, Warning, Info } from "@phosphor-icons/react";
import styles from "./styles.module.css";
export function Toaster() {
@@ -9,6 +9,7 @@ export function Toaster() {
<SonnerToaster
position="bottom-center"
richColors
+ closeButton
toastOptions={{
classNames: {
toast: styles.toastDefault,
@@ -20,6 +21,7 @@ export function Toaster() {
info: styles.toastInfo,
},
}}
+ className="custom__toast"
icons={{
success: <CheckCircle className="h-4 w-4" color="#fff" weight="fill" />,
error: <XCircle className="h-4 w-4" color="#fff" weight="fill" />,