diff options
Diffstat (limited to 'src/view/com/util/Toast.style.tsx')
-rw-r--r-- | src/view/com/util/Toast.style.tsx | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/view/com/util/Toast.style.tsx b/src/view/com/util/Toast.style.tsx index 8b952fd00..3869e6890 100644 --- a/src/view/com/util/Toast.style.tsx +++ b/src/view/com/util/Toast.style.tsx @@ -4,18 +4,42 @@ import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/ico import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo' import {Warning_Stroke2_Corner0_Rounded as WarningIcon} from '#/components/icons/Warning' -export type ToastType = - | 'default' - | 'success' - | 'error' - | 'warning' - | 'info' +export type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' + +export type LegacyToastType = | 'xmark' | 'exclamation-circle' | 'check' | 'clipboard-check' | 'circle-exclamation' +export const convertLegacyToastType = ( + type: ToastType | LegacyToastType, +): ToastType => { + switch (type) { + // these ones are fine + case 'default': + case 'success': + case 'error': + case 'warning': + case 'info': + return type + // legacy ones need conversion + case 'xmark': + return 'error' + case 'exclamation-circle': + return 'warning' + case 'check': + return 'success' + case 'clipboard-check': + return 'success' + case 'circle-exclamation': + return 'warning' + default: + return 'default' + } +} + export const TOAST_ANIMATION_CONFIG = { duration: 300, damping: 15, @@ -165,7 +189,7 @@ export const TOAST_WEB_KEYFRAMES = ` opacity: 1; } } - + @keyframes toastFadeOut { from { opacity: 1; |