Refactor: Remove ant design component (#13143)

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change

- [x] Refactoring
This commit is contained in:
chanx
2026-02-13 18:40:41 +08:00
committed by GitHub
parent bc9ed24a85
commit f2a1d59c36
51 changed files with 1074 additions and 1484 deletions

View File

@@ -0,0 +1,58 @@
import { ExternalToast, toast } from 'sonner';
const defaultConfig: ExternalToast = { duration: 4000, position: 'top-right' };
type NotificationOptions = {
message: string;
description?: string;
duration?: number;
};
const notification = {
success: (options: NotificationOptions) => {
const messageText = options.description
? `${options.message}\n${options.description}`
: options.message;
toast.success(messageText, {
...defaultConfig,
duration: options.duration
? options.duration * 1000
: defaultConfig.duration,
});
},
error: (options: NotificationOptions) => {
const messageText = options.description
? `${options.message}\n${options.description}`
: options.message;
toast.error(messageText, {
...defaultConfig,
duration: options.duration
? options.duration * 1000
: defaultConfig.duration,
});
},
warning: (options: NotificationOptions) => {
const messageText = options.description
? `${options.message}\n${options.description}`
: options.message;
toast.warning(messageText, {
...defaultConfig,
duration: options.duration
? options.duration * 1000
: defaultConfig.duration,
});
},
info: (options: NotificationOptions) => {
const messageText = options.description
? `${options.message}\n${options.description}`
: options.message;
toast.info(messageText, {
...defaultConfig,
duration: options.duration
? options.duration * 1000
: defaultConfig.duration,
});
},
};
export default notification;