fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import { type ExternalToast, toast as sonnerToast } from "sonner"
|
|
import { Toast } from "./Toast"
|
|
|
|
export const toast = {
|
|
success: (message: React.ReactNode, options?: ExternalToast) =>
|
|
sonnerToast.custom(
|
|
(t) => (
|
|
<Toast
|
|
variant="success"
|
|
message={message}
|
|
onClose={() => sonnerToast.dismiss(t)}
|
|
/>
|
|
),
|
|
options
|
|
),
|
|
info: (message: React.ReactNode, options?: ExternalToast) =>
|
|
sonnerToast.custom(
|
|
(t) => (
|
|
<Toast
|
|
variant="info"
|
|
message={message}
|
|
onClose={() => sonnerToast.dismiss(t)}
|
|
/>
|
|
),
|
|
options
|
|
),
|
|
error: (message: React.ReactNode, options?: ExternalToast) =>
|
|
sonnerToast.custom(
|
|
(t) => (
|
|
<Toast
|
|
variant="error"
|
|
message={message}
|
|
onClose={() => sonnerToast.dismiss(t)}
|
|
/>
|
|
),
|
|
options
|
|
),
|
|
warning: (message: React.ReactNode, options?: ExternalToast) =>
|
|
sonnerToast.custom(
|
|
(t) => (
|
|
<Toast
|
|
variant="warning"
|
|
message={message}
|
|
onClose={() => sonnerToast.dismiss(t)}
|
|
/>
|
|
),
|
|
options
|
|
),
|
|
}
|