+ {(icon || title) && (
+
+ {icon}
+ {title}
+
+ )}
+ {description &&
{description}
}
+
+ )
+}
+
+const createToast = (color: ToastColor) => {
+ return (arg: ToastConfig | string): string | null => {
+ const api = getMessageApi()
+ const type = colorToType(color) as 'error' | 'success' | 'warning' | 'info'
+
+ if (typeof arg === 'string') {
+ // antd message methods return a function to close the message
+ api[type](arg)
+ return null
+ }
+
+ const { title, description, icon, timeout, ...restConfig } = arg
+
+ // Convert timeout from milliseconds to seconds (antd uses seconds)
+ const duration = timeout !== undefined ? timeout / 1000 : 3
+
+ return (
+ (api.open({
+ type: type as 'error' | 'success' | 'warning' | 'info',
+ content: