From a192b372ce4618d05543315fdc15ac35ed4763a9 Mon Sep 17 00:00:00 2001 From: emilkowalski Date: Mon, 20 Nov 2023 23:41:55 +0100 Subject: [PATCH] Polish --- src/index.tsx | 9 ++++++++- src/types.ts | 4 ++++ website/src/pages/styling.mdx | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index e75a979..a15b893 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -239,7 +239,14 @@ const Toast = (props: ToastProps) => { role="status" tabIndex={0} ref={toastRef} - className={cn(className, toastClassname, classNames?.toast, toast?.classNames?.toast)} + className={cn( + className, + toastClassname, + classNames?.toast, + toast?.classNames?.toast, + classNames?.[toastType], + toast?.classNames?.[toastType], + )} data-sonner-toast="" data-styled={!Boolean(toast.jsx || toast.unstyled)} data-mounted={mounted} diff --git a/src/types.ts b/src/types.ts index 44a908b..f867b90 100644 --- a/src/types.ts +++ b/src/types.ts @@ -19,6 +19,10 @@ export interface ToastClassnames { closeButton?: string; cancelButton?: string; actionButton?: string; + success?: string; + error?: string; + info?: string; + warning?: string; } export interface ToastT { diff --git a/website/src/pages/styling.mdx b/website/src/pages/styling.mdx index 753fc85..f74d7ad 100644 --- a/website/src/pages/styling.mdx +++ b/website/src/pages/styling.mdx @@ -58,6 +58,21 @@ toast('Hello World', { }); ``` +Styling per toast type is also possible. + +```jsx + +``` + ## No styles You can also disable default styles by going headless.