diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-07-30 18:18:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-30 08:18:36 -0700 |
commit | db7bdae51a1a06e67856b887e4e63a183fa5f479 (patch) | |
tree | 16b993271eb6eb5f55f4fe8808f781ff1da53120 /src/view/com/util/Toast.style.tsx | |
parent | ee7f50871744ac03864cc3feabee6cc23016aab6 (diff) | |
download | voidsky-db7bdae51a1a06e67856b887e4e63a183fa5f479.tar.zst |
Convert old toast types to new ones, mark as deprecated (#8746)
* convert old types to new types * add depreciation warning for old warnings * rm as consts
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; |